Cannot resolve symbol 'context'

You need to do some basic Java programming tutorials. Java is totally different to JavaScript.

Here, you use context as a variable but you have neither declared it, or initialised it, hence the error.

You could define it (and initialise at the same time)

 Context context = this;

since this refers to the current object instance of a class and Activity is a Context, or more precisely, it extends Context.

Alternatively, you could just use this.

File f = File(UploadToServer.this.getCacheDir(), "filename");

The error is bacuse you havent declared context, neither it has been passed as a parameter

change context.getCacheDir() to getApplicationContext.getCacheDir() or this.getCacheDir()

so

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    if( requestCode == CAMERA_PIC_REQUEST)
    {
        Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
        ImageView image =(ImageView) findViewById(R.id.PhotoCaptured);
        image.setImageBitmap(thumbnail);

        //create a file to write bitmap data
        File f = File(context.getCacheDir(), "filename");
        try {
            f.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

will become

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);
    if( requestCode == CAMERA_PIC_REQUEST)
    {
        Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
        ImageView image =(ImageView) findViewById(R.id.PhotoCaptured);
        image.setImageBitmap(thumbnail);

        //create a file to write bitmap data
        File f = File(getApplicationContext.getCacheDir(), "filename");
        try {
            f.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}