Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro JSP
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro JSP Advanced JSP coding questions. Beginning questions will be redirected to the Beginning JSP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro JSP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 29th, 2004, 09:46 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default File Upload in JSP

Hi,

Could somebody helps me on how to do file upload using JSP, is there ane direct way to do without using third party's API?


Thanks,
Jenty
Reply With Quote
  #2 (permalink)  
Old September 30th, 2004, 05:14 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

You can upload from an HTML form.
There is a standard HTML form field that is for file uploads, i.e. it lets the user browse their local machine for the file they wish to upload. The form must use the POST method to upload the file, if you use the GET method you will only send the file name NOT the data.

You must also specify the encoding type for the form.

In the action for the form give the name of your servlet.
Within your servlet you will need to know how to parse posted data to strip out headers and new line characters added by the POST process. Once you have done this you will have your data on your server from where you can manipulate it, save it for file / database.

It is not the easiest thing I have learned, I would suggest you search the Sun Java site. there are tutorials on how to parse POST data which will help you.


Reply With Quote
  #3 (permalink)  
Old September 30th, 2004, 05:21 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: , , .
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello again,

The tutorial I used was at:

http://java.sun.com/developer/online...k/aucserv.html

About half way down is the bit about posting data including code.
I should warn you that I got errors with the servlet code, this was to do with the way it tries to loop round headers.

You will have to play with it to get it working, but its not a bad place to start.

Reply With Quote
  #4 (permalink)  
Old October 1st, 2004, 08:56 AM
Registered User
 
Join Date: Sep 2004
Location: Mumbai, Maharastra, India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have one jar file
com.orange.fupload.MultiPartRequest
u search this jar file on net if u want i have that one i can send to u the file and the code.
By using this u can directly upload the file on server of any format.


Regards
Gaurav Rathi
garathi@rediffmail.com
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to upload file in JSP chitocheng JSP Basics 1 February 2nd, 2007 12:22 PM
hi have to upload excel file using jsp uttam.mca Pro JSP 3 July 14th, 2006 08:30 PM
sample JSP to upload file to database rahulsaxena Pro JSP 2 January 16th, 2006 05:59 AM
JSP file upload and delete file pandjie JSP Basics 0 January 29th, 2005 10:49 PM
upload doc,pdf file from ORACLE 9i on JSP page ashwinmittal Pro JSP 1 November 30th, 2004 01:18 PM



All times are GMT -4. The time now is 11:55 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.