uploadMany
Multi-file upload field.
Please note - this property requires the Editor extension for DataTables.
The full Editor reference documentation is available to registered users of Editor - the information shown below is a summary only. If you already have an Editor license please sign-in, alternatively an Editor license can be purchased on this site, or sign up for the free trial.
Description
The uploadMany
field is very similar to its singular partner, upload
, but allows multiple files to be uploaded and assigned in a single field. This can be useful for cases where you might have multiple supporting documents for a single field - for example photos for an article or PDF case documents.
The UI presented to the end user allows them to upload one or more files at a single time, through either a drag-and-drop interface, or a standard file selection dialogue. Files assigned to the field's value (which must be an array of file identifiers) are shown in a display list below the upload control, and the display
option (detailed below) can be used to tell the field how they should be rendered (this could be a file name, file size, image, icon, etc). Files can be added to the field's value at a time, including after the row's initial creation, and also removed individually using a x
button presented next to each item's rendered display.
The file upload is performed asynchronously to the main form - i.e. as soon as a file is selected it is immediately uploaded to the server and the field adds a value that identifies the file (typically this is a database id for a row containing information about the file, but can also be any other identifying data such as a file name) to its own array of value. This array of field values is then submitted as part of the standard form.
The uploadMany
field type is supported on the server-side by the Upload
(PHP | .NET) and mjoin
(PHP | .NET) classes available in Editor's standard libraries. Please refer to the documentation for those libraries for how to configure the server-side scripts.
Additionally, an overview of how to configure the upload field types on the client-side is available in the Editor manual. The remaining documentation here is concerned solely with detailing the options available for this field type.
Events
This field type can trigger the following events from the input element (field().input()
):
upload.editor
- Upload complete event - this should be used in place of achange
event for this field type. The following parameters are passed in to the event handler: