Interface Uploadable

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  Uploadable.Error
      Uploading error constants.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getUpload()
      Returns non-null if this component is used for file upload, or null otherwise.
      void setUpload​(java.lang.String upload)
      Sets the JavaScript class at the client to handle the upload if this component is used for file upload.
    • Method Detail

      • getUpload

        java.lang.String getUpload()
        Returns non-null if this component is used for file upload, or null otherwise. Refer to setUpload(java.lang.String) for more details.
        Since:
        5.0.0
      • setUpload

        void setUpload​(java.lang.String upload)
        Sets the JavaScript class at the client to handle the upload if this component is used for file upload.

        Default: null.

        For example, the following example declares a button for file upload:

        <button label="Upload" upload="true"
         onUpload="handle(event.media)"/>

        As shown above, after the file is uploaded, an instance of UploadEvent is sent this component.

        If you want to customize the handling of the file upload at the client, you can specify a JavaScript class when calling this method: <button upload="foo.Upload"/>

        Another options for the upload can be specified as follows:

        <button label="Upload" upload="true,maxsize=-1,multiple=true,accept=audio/*|video/*|image/*,native"
        • maxsize: the maximal allowed upload size of the component, in kilobytes, or a negative value if no limit, if the maxsize is not specified, it will use Configuration.getMaxUploadSize()
        • native: treating the uploaded file(s) as binary, i.e., not to convert it to image, audio or text files.
        • multiple: treating the file chooser allows multiple files to upload, the setting only works with HTML5 supported browsers (since ZK 6.0.0).
        • accept: specifies the types of files that the server accepts, the setting only works with HTML5 supported browsers (since ZK 7.0.0).
        • suppressedErrors: specifies the suppressed uploading errors, separated by | (e.g. missing-required-component|illegal-upload) (since ZK 9.5.1).

        Note: if the options of the false or the customized handler (like foo.Upload) are not specified, the option of true is implicit by default.

        Parameters:
        upload - a JavaScript class to handle the file upload at the client, or "true" if the default class is used, or null or "false" to disable the file download (and then this button behaves like a normal button).
        Since:
        5.0.0
        See Also:
        Uploadable.Error