public interface Uploadable
Component
to indicate
that a component can be used for file upload.Modifier and Type | Interface and Description |
---|---|
static class |
Uploadable.Error
Uploading error constants.
|
Modifier and Type | Method and 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.
|
java.lang.String getUpload()
setUpload(java.lang.String)
for more details.void setUpload(java.lang.String 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"
Configuration.getMaxUploadSize()
|
(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.
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).Uploadable.Error
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.