Class UploadedFile


  • public class UploadedFile
    extends Object
    Objects of this class can be used to get information about an uploaded file and save the file to a directory in the filesystem. If the file is not saved, it will be deleted once the object is garbage collected.
    Version:
    2.0
    Author:
    Nicklas
    • Constructor Detail

      • UploadedFile

        UploadedFile​(FileUpload fu,
                     String formName,
                     String filename,
                     String mimeType)
        Create a new UploadedFile object. Use the FileUpload.getFile(String) or FileUpload.getFileValues(String) method to get an object representing the uploaded file.
        Parameters:
        fu - The FileUpload object responsible for the upload
        formName - The name of the form field with this file
        mimeType - The MIME type of the file, or NULL if it is not known
        filename - The original filename of the file, or NULL if it is not known
    • Method Detail

      • getFormName

        public String getFormName()
        Get the name of the form field that this file was selected in.
        Since:
        2.16
      • getFilename

        public String getFilename()
        Get the original filename of the uploaded file. This is the name the file had on the client computer.
        Returns:
        The original name of the file, or NULL if it is not known
      • getExtension

        public String getExtension()
        Get the extension of the original filename. The extension is the part of the filename after the last dot. If the file doesn't have an extension NULL is returned.
        Returns:
        The extension of the file, or NULL if none exists
      • getMimeType

        public String getMimeType()
        Get the MIME type of the uploaded file.
        Returns:
        The MIME type of the file, or NULL if it is not known