File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Upload file using servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Upload file using servlet" Watch "Upload file using servlet" New topic

Upload file using servlet

felix thomas
Ranch Hand

Joined: Jun 10, 2001
Posts: 89
Can anyone show a sample code how to upload a file to a server using servlets. I don't what any third party tool. I am making a servlet which will get from the user the path of the file ,then i have to upload it.
I want the complete code or example how it can be done.
rick zorich

Joined: Aug 31, 2003
Posts: 16
You don't need any thrid party packages. If you have JavaMail in your classpath, then you could use it's methods to parse the multipart request.
Here is demonstration JSP. Please share your final code with us.
Sean Sullivan
Ranch Hand

Joined: Sep 09, 2001
Posts: 427
Jakarta Struts has file upload capabilities.
If you aren't using Struts, look at these libraries:
I agree. Here's the link:
subject: Upload file using servlet
jQuery in Action, 3rd edition