Constructor
JavaScript:
-
new Coral.FileUpload()
ordocument.createElement('coral-fileupload')
HTML Tag:
-
<coral-fileupload>
Extends
Sub-components
Static Properties
-
Coral.FileUpload.method {String}
-
Properties:
Name Type Value Description POST String POST Send a POST request. Used when creating a resource. PUT String PUT Send a PUT request. Used when replacing a resource. PATCH String PATCH Send a PATCH request. Used when partially updating a resource.
Instance Properties
-
instance.accept {String}
Reflected -
- Default Value:
- ""
- HTML Attribute:
- accept
-
instance.action {String}
-
- Default Value:
- ""
- HTML Attribute:
- action
-
instance.async {Boolean}
Reflected -
- Default Value:
- false
-
instance.autoStart {Boolean}
Reflected -
- Default Value:
- false
- HTML Attribute:
- autostart
-
instance.disabled {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- disabled
-
instance.hidden {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- hidden
-
instance.invalid {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- invalid
-
instance.labelledBy {String}
-
- Inherited From:
- Default Value:
- null
- HTML Attribute:
- labelledby
-
instance.method {Coral.FileUpload.method}
-
- Default Value:
- Coral.FileUpload.method.POST
- HTML Attribute:
- method
-
instance.multiple {Boolean}
Reflected -
- Default Value:
- false
- HTML Attribute:
- multiple
-
instance.name {String}
Reflected -
- Inherited From:
- Default Value:
- ""
- HTML Attribute:
- name
-
instance.parameters {Array.<Object>}
-
- Default Value:
- []
-
instance.readOnly {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- readonly
-
instance.required {Boolean}
Reflected -
- Inherited From:
- Default Value:
- false
- HTML Attribute:
- required
-
instance.sizeLimit {Number}
-
- Default Value:
- 0
- HTML Attribute:
- sizelimit
-
instance.uploadQueue {Array.<Object>}
Readonly -
- Default Value:
- []
-
instance.value {String}
-
- Inherited From:
- Default Value:
- ""
- HTML Attribute:
- value
-
instance.values {Array.<String>}
-
<input accept="audio/*,video/*,image/*" />
.
<form>
tag to upload
synchronously, the action of the form is used. If an element is clicked that has a
[coral-fileupload-submit]
attribute as well as a [formaction]
attribute, the action of
the clicked element will be used. Set this property before calling Coral.FileUpload#upload to reset the
action set by a click.
<form>
tag. One option excludes the other. Setting a new async
value removes all
files from the queue.
aria-labelledby
attribute. This will ensure that the component is properly identified for
accessibility purposes. It reflects the aria-labelledby
attribute to the DOM.
<form>
tag to
upload synchronously, the method of the form is used. If an element is clicked that has a
[coral-fileupload-submit]
attribute as well as a [formmethod]
attribute, the method of
the clicked element will be used. Set this property before calling Coral.FileUpload#upload to reset the
method set by a click.
name
key:value and optionally a value
key:value.
false
, this will be an array of length 1.
Methods
-
instance.abort
-
- Parameters:
-
Name Type Optional Description filename String Yes
The filename of the file to abort. If a filename is not provided, all files will be aborted.
-
instance.clear
-
- Parameters:
-
Name Type Optional Description filename String Yes
The filename of the file to remove. If a filename is not provided, all files will be removed.
-
instance.get
-
- Parameters:
-
Name Type Description property String The name of the property to fetch the value of. - Returns:
-
Property value. {*}
- Inherited From:
-
instance.hide
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.off
-
- Parameters:
-
Name Type Optional Description eventName String No
The event name to stop listening for. selector String Yes
The selector that was used for event delegation. func function No
The function that was passed to on()
.useCapture Boolean Yes
Only remove listeners with useCapture
set to the value passed in. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.on
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to listen for. selector String Yes
The selector to use for event delegation. func function No
The function that will be called when the event is triggered. useCapture Boolean Yes
Whether or not to listen during the capturing or bubbling phase. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.remove
-
- Inherited From:
-
instance.set
-
- Parameters:
-
Name Type Description property String The name of the property to set. value * The value to set the property to. silent Boolean If true, events should not be triggered as a result of this set. - Returns:
-
this, chainable. {Coral.Component}
- Inherited From:
-
instance.show
-
- Returns:
-
this, chainable {Coral.Component}
- Inherited From:
-
instance.trigger
-
- Parameters:
-
Name Type Optional Default Description eventName String No
The event name to trigger. props Object Yes
Additional properties to make available to handlers as event.detail
.bubbles Boolean Yes
Set to false
to prevent the event from bubbling.cancelable Boolean Yes
Set to false
to prevent the event from being cancelable. - Returns:
-
CustomEvent object {CustomEvent}
- Inherited From:
-
instance.upload
-
- Parameters:
-
Name Type Optional Description filename String Yes
The name of the file to upload.
Events
-
change
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
-
coral-component:attached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserver
instead.
- since 1.14.0, use
-
coral-component:detached
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.14.0, use
MutationObserver
instead.
- since 1.14.0, use
-
coral-component:ready
-
- Callback Parameters:
-
Name Type Description event Object Event object.
- Inherited From:
- Deprecated:
- since 1.9.0, use
Coral.commons.ready()
instead.
- since 1.9.0, use
-
coral-fileupload:abort
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:dragenter
-
- Callback Parameters:
-
Name Type Description event Object Event object
-
coral-fileupload:dragleave
-
- Callback Parameters:
-
Name Type Description event Object Event object
-
coral-fileupload:dragover
-
- Callback Parameters:
-
Name Type Description event Object Event object
-
coral-fileupload:drop
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:error
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:fileadded
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:filemimetyperejected
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.item Coral.FileUpload.Item The rejected FileUpload item.
-
coral-fileupload:fileremoved
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:filesizeexceeded
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.item Coral.FileUpload.Item The rejected FileUpload item.
-
coral-fileupload:load
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:loadend
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:loadstart
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:progress
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item. event.detail.lengthComputable Boolean Whether the upload progress can be calculated. event.detail.loaded Number The upload progress in bytes. event.detail.total Number The total upload size in bytes.
-
coral-fileupload:readystatechange
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.
-
coral-fileupload:timeout
-
- Callback Parameters:
-
Name Type Description event Object Event object
Name Type Description event.detail.action Object The URL the file is being uploaded to. event.detail.method Coral.FileUpload.method HTTP method used to upload. event.detail.item Coral.FileUpload.Item FileUpload item.