upload
Single 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 ability to upload files is an important element in complex forms and data structures. The upload
field type provides that ability to Editor by presenting an file upload control to the end user, giving them the option of uploading a single file for the field (the uploadMany
field type allows multiple files to be assigned to a single field)
The file upload is performed asynchronously to the main form - i.e. as soon as a file is selected, either via drag-and-drop or a standard file selection control, it is immediately uploaded to the server and the field will take 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). This field value is then submitted as part of the standard form.
The upload
field type is supported on the server-side by the Upload
class available in Editor's standard libraries (PHP | .NET). 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:object
event
- The event objectAny
value
- File identifier from the server - normally a primary key value or a file name.