Hi Jay, It works if I give in this way but I wanted to upload by giving relative path. i.e. the context in which the application is working. Also if I print File fileTemp = new File(fileName2); System.out.println("fileTemp: "+fileTemp.getAbsolutePath());
I get fileTemp: D:\upload\images\test.jpg which actually doesn't exist. Any ideas on how to over come this issue? Uma -----Original Message----- From: Jay Chandran [mailto:[EMAIL PROTECTED] Sent: Sunday, December 19, 2004 12:59 PM To: Struts Users Mailing List Subject: Re: file upload problem how is ur file path given ??/ please try to give the full path ie like "C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\" ie filePath value should be C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\ ie in your jsp page give something as below . <INPUT TYPE ="hidden" NAME ="filePath" size="39" value="C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\"/> ----- Original Message ----- From: "uma.k" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>; "'Jay Chandran'" <[EMAIL PROTECTED]> Sent: Sunday, December 19, 2004 12:32 PM Subject: RE: file upload problem > 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] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]