The default {@link org.apache.tomcat.util.http.fileupload.FileItemFactory}implementation. This implementation creates {@link org.apache.tomcat.util.http.fileupload.FileItem} instances which keeptheir content either in memory, for smaller items, or in a temporary file on disk, for larger items. The size threshold, above which content will be stored on disk, is configurable, as is the directory in which temporary files will be created.
If not otherwise configured, the default configuration values are as follows:
- Size threshold is 10KB.
- Repository is the system default temp directory, as returned by
System.getProperty("java.io.tmpdir")
.
NOTE: Files are created in the system default temp directory with predictable names. This means that a local attacker with write access to that directory can perform a TOUTOC attack to replace any uploaded file with a file of the attackers choice. The implications of this will depend on how the uploaded file is used but could be significant. When using this implementation in an environment with local, untrusted users, {@link #setRepository(File)} MUST be used to configure a repository locationthat is not publicly writable. In a Servlet container the location identified by the ServletContext attribute javax.servlet.context.tempdir
may be used.
Temporary files, which are created for file items, should be deleted later on.
@since FileUpload 1.1
@version $Id: DiskFileItemFactory.java 1521056 2013-09-09 11:37:47Z markt $