Class UploadServlet

  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bySK.gnome.dwarf.http.servlet.UploadServlet
All Implemented Interfaces:, javax.servlet.Servlet, javax.servlet.ServletConfig

public class UploadServlet
extends javax.servlet.http.HttpServlet

This servlet handles the form-based file uploads. To upload a file to the server via the HTTP protocol you can use this servlet. The servlet should be invoked from a special HTML form. The <form ...> HTML element must have the action attribute equal to "POST" and the enctype attribute equal to "multipart/form-data". One of the form input fields must be of type file with its name attribute equal to "localFile" string.

The following parameters can be provided to UploadServlet, either via the query string or via the form input elements:

A typicall file-uploading form might look like this:
 <form method="POST" action="/upload" enctype="multipart/form-data">
   <input type="hidden" name="remoteDir" value="/tmp">
   <input type="hidden" name="successPage" value="/upload_ok.html">
   <input type="hidden" name="errorPage" value="/upload_error.html">
   <input type="file" name="localFile">
   <input type="submit" name="submit" value="OK">

After the server processes the multipart/form-data request body the following information can be obtained from the request, assuming that the file form input element is named "localFile":

See Also:
Serialized Form

Constructor Summary
Method Summary
protected  void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
 java.lang.String getServletInfo()
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doOptions, doPut, doTrace, getLastModified, service, service
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public UploadServlet()
Method Detail


public java.lang.String getServletInfo()


protected void doPost(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)

Copyright (c) 1999-2005, Gnome Ltd. All rights reserved.