onChangeStatus | func | | called every time fileWithMeta.meta.status changes; receives (fileWithMeta, status, []fileWithMeta); possible status values are 'rejected_file_type', 'rejected_max_files', 'preparing', 'error_file_size', 'error_validation', 'ready', 'started', 'getting_upload_params', 'error_upload_params', 'uploading', 'exception_upload', 'aborted', 'restarted', 'removed', 'error_upload', 'headers_received', 'done' |
getUploadParams | func | | called after file is prepared and validated, right before upload; receives fileWithMeta object; should return params needed for upload: { fields (object), headers (object), meta (object), method (string), url (string) }; omit to remove upload functionality from dropzone |
onSubmit | func | | called when user presses submit button; receives array of fileWithMeta objects whose status is 'headers_received' or 'done'; also receives array of all fileWithMeta objects as second argument; omit to remove submit button |
accept | string | '*' | the accept attribute of the file dropzone/input |
multiple | bool | true | the multiple attribute of the file input |
minSizeBytes | number | 0 | min file size in bytes (1024 * 1024 = 1MB) |
maxSizeBytes | number | 2^53 - 1 | max file size in bytes (1024 * 1024 = 1MB) |
maxFiles | number | 2^53 - 1 | max number of files that can be tracked and rendered by the dropzone |
validate | func | | generic validation function called after file is prepared; receives fileWithMeta object; should return falsy value if validation succeeds; should return truthy value if validation fails, which sets meta.status to 'error_validation', and sets meta.validationError to the returned value |
autoUpload | bool | true | pass false to prevent file from being uploaded automatically; sets meta.status to 'ready' (instead of 'getting_upload_params') after file is prepared and validated; you can call fileWithMeta.restart whenever you want to initiate file upload |
timeout | number | | pass an integer to make upload time out after this many ms; if upload times out, onChangeStatus is invoked with value 'exception_upload' |
initialFiles | File[] | | add these files to dropzone, without any user interaction; if a new array of initialFiles is passed, they will also be added to dropzone; see here for an example of creating and uploading a file from a data URL |