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

file upload in servlet?

kriti sharma
Ranch Hand

Joined: Feb 16, 2001
Posts: 160
i have a form which lets the user choose three files from its system by the <input type=file> form element. i have put the <form enctype="multipart/form-data" action="some_url" method="PUT">
i do not know how to use PUT. what url must be specified here. can some one please give an example and explain.

is it that this file upload can only be done by PUT request? because the form has two text fields as well. how can i retrieve files as well as text informations?
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You can use POST and a multi-part reader. Lots of people start with Jason Hunter's code: I found his Java to look a lot like a literal translation from C or some procedural langauge, but it works. Remember that anti-hamburger commercial ... don't look under the hood?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: file upload in servlet?
It's not a secret anymore!