Discussions

Web tier: servlets, JSP, Web frameworks: Problem in Uploading a file Through a Servlet - Help Needed

  1. Hi,

    I am in the process of writing a program which uploads a file being selected by <pre> <input type=file> </pre>. Please help me in this regard.

    I want the source code for this, if possible.

    Thanks in advance.
    Ramagopal
  2. you can use the java provided class MultipartRequest which is available in java help in sun.java.com.
      first you have to send the request to a servlet as a method post. In that servlet you have to create an object of Multipartrequest class by send the arguments the HttpRequest object and the size of the file. Automatically it will upload the file to the targetted directory.

    regards
    sridhar tida.
  3. Hi,
     I cannot find the class MultipartRequest. Can you help me in that.

    Ramagopal
  4. Hi,
    you can find the class in the site : http://www.servlets.com/resources/com.oreilly.servlet/

    it is provided by O'reilly.