Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Uploading file

Posted on 2004-09-28
6
Medium Priority
?
519 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 500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Sometimes Administrators rights are not enough. These cases call for the SYSTEM account. The process in this article outlines the steps required to execute commands using the SYSTEM account.
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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