Interface DiskFileItemFactory


public interface DiskFileItemFactory

A factory interface for creating FileItem and Media instances. Factories can provide their own custom configuration, over and above that provided by the default file upload implementation.
Unlike FileItemFactory, this factory needs two extra information, sizeThreshold and repository.

Since:
8.0.2
Author:
jumperchen
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.commons.fileupload2.core.FileItem
    createItem(String fieldName, String contentType, boolean isFormField, String fileName, int sizeThreshold, File repository)
    Create a new FileItem instance from the supplied parameters and any local factory configuration.
    org.zkoss.util.media.Media
    createMedia(org.apache.commons.fileupload2.core.FileItem fileItem, String contentType, String fileName, boolean isNative)
    Create a new Media instance from from the supplied parameters and any local factory configuration.
  • Method Details

    • createItem

      org.apache.commons.fileupload2.core.FileItem createItem(String fieldName, String contentType, boolean isFormField, String fileName, int sizeThreshold, File repository)
      Create a new FileItem instance from the supplied parameters and any local factory configuration.
      Parameters:
      fieldName - The name of the form field.
      contentType - The content type of the form field.
      isFormField - true if this is a plain form field; false otherwise.
      fileName - The name of the uploaded file, if any, as supplied by the browser or other client.
      sizeThreshold - The threshold, in bytes, below which items will be retained in memory and above which they will be stored as a file, if any.
      repository - The data repository, which is the directory in which files will be created, should the item size exceed the threshold, if any.
      Returns:
      The newly created file item.
    • createMedia

      org.zkoss.util.media.Media createMedia(org.apache.commons.fileupload2.core.FileItem fileItem, String contentType, String fileName, boolean isNative)
      Create a new Media instance from from the supplied parameters and any local factory configuration.
      Parameters:
      fileItem - The instance of the upload file.
      contentType - The content type of the form field.
      fileName - The name of the uploaded file, if any, as supplied by the browser or other client.
      isNative - whether the file item is a binary type.
      Returns:
      The newly created media.