NO, this might not be best solution as the folders are already existing and
If I have to move from one OS to another OS then this would be a problem.
So, I wanted to upload the file to relative path rather than absolute path.

Any one please?

-----Original Message-----
From: yue pengfei [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 19, 2004 3:53 PM
To: Struts Users Mailing List
Subject: RE: file upload problem


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兆,雅虎电邮自助扩容!


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

Reply via email to