Solved

Uploading file

Posted on 2004-09-28
6
500 Views
Last Modified: 2010-04-01
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
0
Comment
Question by:Manish
  • 4
  • 2
6 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12168665
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
 
LVL 35

Expert Comment

by:TimYates
ID: 12168675
There are examples on its usage here:

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

Good luck!!

Tim
0
 
LVL 11

Author Comment

by:Manish
ID: 12169112
Will u please explain some steps ?after getting zip file?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 12169191
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
 
LVL 11

Author Comment

by:Manish
ID: 12177457
Thanks TimYates..
  I used oreilly package...
http://www.servlets.com/cos/index.html
Ur answers  helped me lot..
Karan
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12177491
Cool :-)  That's the other well used package for doing it :-)

Glad I could help!!

Good luck!!

Tim
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SimpleDateFormat.parse examples 19 87
servlet concurrency 13 92
getting param value 7 51
Can't access image with tomcat/html 6 95
What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now