This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes How to upload a file using a servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to upload a file using a servlet?" Watch "How to upload a file using a servlet?" New topic
Author

How to upload a file using a servlet?

chad stevens
Ranch Hand

Joined: Aug 20, 2002
Posts: 88
How do you upload a file using a servlet?
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi chad,
can you use multipart/form-data? look at com.oreilly.servlet api that has MultipartRequest handler etc to handle these multipart/form-data requests fromthe browser...
you can use html's file input type to browse the file you want to upload via the servlet and achieve what you want..
regards
maulin
Kayla Richard
Greenhorn

Joined: Jan 20, 2003
Posts: 29
Hi Maulin.
Thanks. I looked at that already and it seems quite complex and I think with certain file types it may not work. How about SmartUpload? Are you familiar with this?
chad stevens
Ranch Hand

Joined: Aug 20, 2002
Posts: 88
Kayla.
I think JSPSmartUpload can only be used with JSP I am not too sure about this, it's why I am posting! You are right, MultiParse does look complex.
 
 
subject: How to upload a file using a servlet?