This may be a problem, but not for that reason.  There is nothing
inconsistent between this solution and moving between different OSs. 
The questions in that case is not whether the path is absolute or
relative but whether it is OS dependent.  Those are very different
questions.

Jack


On Mon, 20 Dec 2004 11:50:01 +0530, uma.k <[EMAIL PROTECTED]> wrote:
> 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]
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

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

Reply via email to