Solved

Uploading file

Posted on 2004-09-28
6
509 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
In this blog we highlight approaches to managed security as a service.  We also look into ConnectWise’s value in aiding MSPs’ security management and indicate why critical alerting is a necessary integration.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 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