Skip to Content
0
Sep 14, 2014 at 05:57 AM

File Not Found Exception :: File Upload

61 Views

Hi,

I am using File Upload functionality to upload a file to the server temporarily and then reading it again back ..

I am using the below code to upload the file to the server..,

int temp = 0;

File f = new File(wdContext.currentcontextElement().getFileResource().getResourceName().toString());

FileOutputStream fos = new FileOutputStream(f);

if(wdContext.currentcontextElement().getFileResource() != null)

{

InputStream stream = wdContext.currentcontextElement().getFileResource().read(false);

while((temp = stream.read()) != -1)

{

fos.write(temp);

}

}

fos.flush();

fos.close();

path = f.getAbsolutePath();

When I try to read the file from the above path I am getting the File not found exception ....

The above code works fine in Dev but having issues in Q . Any particular reasons ???? Any help would be highly appreciated ....

Thanks.....