Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uploading a file

Status
Not open for further replies.

lowbk

Technical User
Nov 26, 2001
162
SG
hi guys, i need help with this.
i am writing a jsp to upload a file and i already found a java program (bean/servlet) for that. but that program takes in the path.

my question is, how to pop up a window for users to select the file. i wanna achieve something like the browse button when we upload file attachments in our email.

any suggestion, or if do you know of any available bean on this?
 
i found the answer to the browse button. it is actually <input type=&quot;file&quot;>

but now i got problems with the uploading, does anyone knows where i can find sample code (bean/servlet) for uploading a file?
 
Try - they have a good package which includes a file upload class.

you can use it like this, on the page where you are selecting the file to be uploaded the form tag should look something like this

<FORM ENCTYPE=&quot;multipart/form-data&quot; name=&quot;formname&quot; method=&quot;POST&quot; action=&quot;dest&quot;>

then on the dest page import the package and use the following code to complete the upload

MultipartRequest mpr = new MultipartRequest (request, dir);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top