Solved

Uploading file

Posted on 2004-09-28
6
499 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
Comment Utility
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
Comment Utility
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
Comment Utility
Will u please explain some steps ?after getting zip file?
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Cool :-)  That's the other well used package for doing it :-)

Glad I could help!!

Good luck!!

Tim
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
A procedure for exporting installed hotfix details of remote computers using powershell
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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