<?xml version="1.0"?>

<document>

  <properties>
    <title>Home</title>
    <author email="martinc@apache.org">Martin Cooper</author>
  </properties>

  <body>

    <section name="Introduction">
      <p>
        The Commons <strong>FileUpload</strong> package makes it easy to add
        robust, high-performance, file upload capability to your servlets and
        web applications.
      </p>
      <p>
        FileUpload parses HTTP requests which conform to
        <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>,
        "Form-based File Upload in HTML". That is, if an HTTP request is
        submitted using the POST method, and with a content type of
        "multipart/form-data", then FileUpload can parse that request, and
        make the results available in a manner easily used by the caller.
      </p>
    </section>

    <section name="Using FileUpload">
      <p>
        Your application should detect whether or not FileUpload should be
        invoked, based on the HTTP method and the content type of the request.
      </p>
      <p>
        Assuming that you have decided that FileUpload should be invoked, you
        might write the following code to handle a file upload request:
<pre>
    // Create a new file upload handler
    FileUpload upload = new FileUpload();

    // Set upload parameters
    upload.setSizeMax(MAX_UPLOAD_SIZE);
    upload.setSizeThreshold(MAX_MEMORY_SIZE);
    upload.setRepositoryPath(TEMP_DIR);

    // Parse the request
    List items = upload.parseRequest(request);

    // Process the uploaded fields
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
        FileItem item = (FileItem) iter.next();

        if (item.isFormField()) {
            processTextParameter(request, item);
        } else {
            processFileParameter(request, item);
        }
    }
</pre>
      </p>
    </section>

  </body>

</document>

Add documentation intro for FileUpload.
Add documentation intro for FileUpload.


git-svn-id: be0410ddac3d3aa4e6c95f624a496c374490f191@133287 13f79535-47bb-0310-9956-ffa450edef68
