Uploading file

Hi,
  I have this code in my jsp..to upload file..

  <form ENCTYPE='multipart/form-data' name="frmuploaddcument" method="post" action="<%=basePath%>servlet/UploadPhotoSer">    
   <table align="center">
        <td>File URI</td>
        <input type="hidden" name="enrollmentno" value="<%=enrollment_no%>">
        <td><input type=file name="FileName" ></td>  
      </tr>
If I dont write ENCTYEP then I m getting some error,
I I write that
   I m getting null values of enrollmentno in servlet ?
Wht should I do?

Plz help..
Karan
LVL 11
ManishLeadAsked:
Who is Participating?
 
TimYatesConnect With a Mentor Commented:
Download:  http://www.mirror.ac.uk/mirror/ftp.apache.org/jakarta/commons/fileupload/binaries/commons-fileupload-1.0.zip

Extract the file commons-fileupload-1.0.jar, and put it in WEB-INF/lib of your webapp

Follow the instructions on http://jakarta.apache.org/commons/fileupload/using.html

:-)
0
 
TimYatesCommented:
To post the file, it HAS to be a multipart (which is why you need ENCTYPE), but when it is multipart, you have to do some extra work to extract the parameters out (as the parameters are stored in a Part in the request, not just in the request)

You are probably better off using something like:

http://jakarta.apache.org/commons/fileupload/

which is a library to handle just this type of thing :-)
0
 
TimYatesCommented:
There are examples on its usage here:

http://jakarta.apache.org/commons/fileupload/using.html

Good luck!!

Tim
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ManishLeadAuthor Commented:
Will u please explain some steps ?after getting zip file?
0
 
ManishLeadAuthor Commented:
Thanks TimYates..
  I used oreilly package...
http://www.servlets.com/cos/index.html
Ur answers  helped me lot..
Karan
0
 
TimYatesCommented:
Cool :-)  That's the other well used package for doing it :-)

Glad I could help!!

Good luck!!

Tim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.