Link to home
Start Free TrialLog in
Avatar of emsysindia
emsysindia

asked on

path of file is cannot identified while img uploading servlet

I m using a jsp file for image upload  and forwording the paths to a servlet class.
But in servlet class the file name is retrieving(like aa.jpg), but the complete path of file is not showing.
<FORM action="ImageUpload"
enctype="multipart/form-data" >
<INPUT type="hidden" name="ID" value="1">
<TABLE BORDER=1>
<TR>
<TD ALIGN="center">
<input type="text" name="companyId" id="ppp">
<input type="hidden" id="aaa" >
 
Filename: <INPUT type="file" name="submitfile1" size="40">
Filename:<INPUT type="file" name="submitfile2" size="40">
Filename:<INPUT type="file" name="submitfile3" size="40">
</TD>
</TR>
<TR>
<TD ALIGN="center">
<center>
<input type="submit" onClick="aaa();">
<INPUT type="reset">
</center>
</TD>
</TR>
</TABLE>
</FORM>
 
 
 
 
ImageUpload.java
 
request.getParameter("submitfile1");  //prints only file name(aa.jpg) not complete path(like D:\BackUp\MyPrograms\images\aa.jpg)
 
plz help, this is an urgent issue.

Open in new window

Avatar of J4M3S_UK
J4M3S_UK

You seem to be forgetting that the servlet will be executing on the server, and the file will be on the client where it cannot be accessed. You need to look at Commons FileUpload to help you upload the file.... http://commons.apache.org/fileupload/
Avatar of emsysindia

ASKER

by refering this page... i got solution
http://www.roseindia.net/jsp/file_upload/uploadingMultipleFiles.shtml
 
 
ASKER CERTIFIED SOLUTION
Avatar of J4M3S_UK
J4M3S_UK

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial