Class FileUploadField

    • Method Detail

      • getFileUpload

        public FileUpload getFileUpload()
        Returns:
        the first uploaded file if HTML5 <input type="file" multiple /> is used and the browser supports multiple, otherwise returns the single uploaded file.
        See Also:
        getFileUploads()
      • getFileUploads

        public List<FileUploadgetFileUploads()
        Returns:
        a list of all uploaded files. The list is empty if no files were selected. It will return more than one files if:
        • HTML5 <input type="file" multiple /> is used
        • the browser supports multiple attribute
        • the user has selected more than one files from the Select file dialog
      • updateModel

        public void updateModel()
        Description copied from class: FormComponent
        Updates this components model from the request, it expects that the object is already converted through the convertInput() call that is called by the validate() method when a form is being processed. By default it just does this:
         setModelObject(getConvertedInput());
         
        DO NOT CALL THIS METHOD DIRECTLY UNLESS YOU ARE SURE WHAT YOU ARE DOING. USUALLY UPDATING YOUR MODEL IS HANDLED BY THE FORM, NOT DIRECTLY BY YOU.
        Specified by:
        updateModel in interface IFormModelUpdateListener
        Overrides:
        updateModel in class FormComponent<List<FileUpload>>
      • convertValue

        protected List<FileUploadconvertValue​(String[] value)
                                         throws org.apache.wicket.util.convert.ConversionException
        Description copied from class: FormComponent
        Subclasses should overwrite this if the conversion is not done through the type field and the IConverter. WARNING: this method may be removed in future versions. If conversion fails then a ConversionException should be thrown
        Overrides:
        convertValue in class FormComponent<List<FileUpload>>
        Parameters:
        value - The value can be the getInput() or through a cookie
        Returns:
        The converted value. default returns just the given value
        Throws:
        org.apache.wicket.util.convert.ConversionException - If input can't be converted
      • forceCloseStreamsOnDetach

        protected boolean forceCloseStreamsOnDetach()
        The FileUploadField will close any input streams you have opened in its FileUpload by default. If you wish to manage the stream yourself (e.g. you want to use it in another thread) then you can override this method to prevent this behavior.
        Returns:
        true if stream should be closed at the end of request