Uploads the files that the site visitor has chosen.
The uploadFiles()
function triggers the upload of the files in the
upload button's value property.
The uploadFiles()
function allows you to upload image, video, audio, document, and gallery (both images and video) files. You can upload multiple image, video, and gallery files at a time.
Use the fileLimit
property to set the number of files you can upload at a time.
Note that this function does not yet support multiple audio and document file uploads. You can only upload audio and document files one at a time, and the fileLimit
property is restricted to 1.
The upload button does not accept files larger than certain sizes, depending on the file type. Maximum allowed file sizes are listed here.
uploadFiles()
returns promptly (meaning, it does not attempt to contact the upload server) with UploadError
when either the validityState
's fileSizeExceedsLimit
or fileTypeNotAllowed
property is true
.
Note:
This function replaces the deprecated
startUpload()
.
The deprecated function will continue to work, but it will not receive updates.
To keep any existing code compatible with future changes, see the
migration instructions.