org.apache.tomcat.util.http.fileupload.disk (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.util.http.fileupload.disk

# Package org.apache.tomcat.util.http.fileupload.disk

package org.apache.tomcat.util.http.fileupload.disk

A disk-based implementation of the `FileItem` interface. This implementation retains smaller items in memory, while writing larger ones to disk. The threshold between these two is configurable, as is the location of files that are written to disk.

In typical usage, an instance of `DiskFileItemFactory` would be created, configured, and then passed to a `FileUpload` implementation.

The following code fragment demonstrates this usage.

           DiskFileItemFactory factory = new DiskFileItemFactory();
           // maximum size that will be stored in memory
           factory.setSizeThreshold(4096);
           // the location for saving data that is larger than getSizeThreshold()
           factory.setRepository(new File("/tmp"));

           ServletFileUpload upload = new ServletFileUpload(factory);

Please see the FileUpload User Guide for further details and examples of how to use this package.

- Related Packages
  Package
  Description
  org.apache.tomcat.util.http.fileupload
  NOTE: This code has been copied from commons-fileupload 1.x and commons-io 1.4 and package renamed to avoid clashes with any web apps that may wish to use these libraries.
  org.apache.tomcat.util.http.fileupload.impl
  Implementations and exceptions utils.
  org.apache.tomcat.util.http.fileupload.servlet
  An implementation of `FileUpload` for use in servlets conforming to JSR 53.
  org.apache.tomcat.util.http.fileupload.util
  This package contains various IO related utility classes or methods, which are basically reusable and not necessarily restricted to the scope of a file upload.
- Classes
  Class
  Description
  DiskFileItem
  The default implementation of the `FileItem` interface.
  DiskFileItemFactory
  The default `FileItemFactory` implementation.