May be you need setup the full path of your file ,as below
File f = new File(filePath);
f.mkdirs();


"uma.k" <[EMAIL PROTECTED]> wrote:
Hi Jay,
I tried this way too, but I am actually getting FileNotFoundException. This
is the modified code
String filePath = theForm.getFilePath();
System.out.println("filePath:"+filePath);
String fileName2 = filePath+fileName;
System.out.println("fileName2:"+fileName2);
//byte[] fileContent =file.getFileData();
OutputStream bos = new FileOutputStream(new File(fileName2));
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();

In the catch block I made SOP to print the exception and this is the output
in Tomcat console.

filePath:/upload/images/
fileName2:/upload/images/test.jpg
fnfejava.io.FileNotFoundException: \upload\images\test.jpg (The system
cannot
find the path specified)

Why is the system not able to find out the path?

Uma


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
美女明星应有尽有,搜遍美图、艳图和酷图
1G就是1000兆,雅虎电邮自助扩容!

Reply via email to