Overview of the org.apache.commons.fileupload.disk component
A disk-based implementation of the
{@link org.apache.commons.fileupload.FileItem 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
{@link org.apache.commons.fileupload.disk.DiskFileItemFactory DiskFileItemFactory}
would be created, configured, and then passed to a
{@link org.apache.commons.fileupload.FileUpload FileUpload}
implementation such as
{@link org.apache.commons.fileupload.servlet.ServletFileUpload ServletFileUpload}
or
{@link org.apache.commons.fileupload.portlet.PortletFileUpload PortletFileUpload}.
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.
|