The regular expression for allowed file types, matches against either file type or file name as only browsers with support for the File API report the file type.
A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept request header. This header tells the server what kind of response it will accept in return.
The add callback can be understood as the callback for the file upload request queue. It is invoked as soon as files are added to the fileupload widget - via file input selection, drag & drop or add API call.
The data parameter allows to override plugin options as well as define ajax settings
data.files holds a list of files for the upload request: If the singleFileUploads option is enabled (which is the default), the add callback will be called once for each file in the selection for XHR file uploads, with a data.files array length of one, as each file is uploaded individually. Else the add callback will be called once for each file selection.
The upload starts when the submit method is invoked on the data parameter.
data.submit() returns a Promise object and allows to attach additional handlers using jQuery's Deferred callbacks.
The default add callback submits the files if the autoUpload option is set to true (the default for the basic plugin). It also handles processing of files before upload, if any process handlers have been registered.
The added callback is the equivalent to the add callback and is triggered after the upload template has been rendered and the transition effects have completed.
Callback for completed (success, abort or error) upload requests. This callback is the equivalent to the complete callback provided by jQuery ajax().
By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done().
Define the name of the property that the preview element is stored as on the File object.
By default, uploads are started automatically when adding files.
Please note that in the basic File Upload plugin, this option is set to true
by default.
Interval in milliseconds to calculate progress bitrate.
If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
Callback for change events of the fileInput collection.
Callback for completed (success, abort or error) chunk upload requests.
Callback before the start of each chunk upload request, before form data is initialized.
Callback for successful chunk upload requests.
Callback for failed (abort or error) chunk upload requests
Callback for the start of each chunk upload request, after form data is initialized.
If this callback returns false
, the chunk upload request is aborted.
A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "nocontent", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
The completed callback is the equivalent to the done callback and is triggered after successful uploads after the download template has been rendered and the transition effects have completed.
When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. Note: For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server.
An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type.
This object will be the context of all Ajax-related callbacks. By default, the context is an object that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response.
If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain.
Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
The type of data that is expected back from the server.
Note: The UI version of the File Upload plugin sets this option to "json" by default.
Callback for file deletion events.
Note Since the UI version already sets this callback option, it is recommended to use the event binding method to attach additional event listeners.
The destroyed callback is the equivalent to the destroy callback and is triggered after files have been deleted, the transition effects have completed and the download template has been removed.
Disable audio previews.
Disable parsing EXIF data.
Disable parsing EXIF GPS data.
Disable parsing the EXIF Sub IFD (additional EXIF info).
Disable parsing the EXIF Thumbnail.
Disable parsing and storing the image header.
Disable loading and therefore processing of images.
Disable parsing image meta data (image head and EXIF data).
Disables saving the image meta data into the resized images.
Disables image previews.
Disables the resize image functionality.
Disables file validation.
Disable video previews.
Callback for successful upload requests. This callback is the equivalent to the success callback provided by jQuery ajax() and will also be called if the server returns a JSON response with an error property.
The upload template function.
The ID of the download template, given as parameter to the tmpl() method to set the downloadTemplate option.
Callback for dragover events of the drop zone collection.
To prevent the plugin from calling the preventDefault()
method on the original dragover event object and
setting the dataTransfer.dropEffect
to copy, call the preventDefault()
method on the event object of the
fileuploaddragover
callback.
Note: The file upload plugin only provides a dragover callback, as it is used to make drag&drop callbacks work. If you want callbacks for additional drag events, simply bind to these events with JQuery's native event binding mechanism on your dropZone element.
Callback for drop events of the drop zone collection.
The drop target jQuery object, by default the complete document.
Set to null or an empty jQuery collection to disable drag & drop support.
The MIME type of content that is used to submit the form to the server. Possible values are:
"application/x-www-form-urlencoded": The initial default type.
"multipart/form-data": The type that allows file element(s) to upload file data.
"text/plain": A type introduced in HTML5.
A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
Callback for failed (abort or error) upload requests. This callback is the equivalent to the error callback provided by jQuery ajax() and will not be called if the server returns a JSON response with an error property, as this counts as successful request due to the successful HTTP response.
The failed callback is the equivalent to the fail callback and is triggered after failed uploads after the download template has been rendered and the transition effects have completed.
The file input field(s), that are listened to for change events.
If undefined, it is set to the file input fields inside of the widget element on plugin initialization.
Set to null to disable the change listener.
The container for the files listed for upload / download.
Is transformed into a jQuery object if set as DOM node or string.
The finished callback is the equivalent to the always callback and is triggered after both completed and failed uploads after the equivalent template has been rendered and the transition effects have completed.
Set this option to true to force iframe transport uploads, even if the browser is capable of XHR file uploads.
This can be useful for cross-site file uploads, if the Access-Control-Allow-Origin
header cannot be set for
the server-side upload handler which is required for cross-site XHR file uploads.
Allows to set the accept-charset attribute for the iframe upload forms.
If formAcceptCharset
is not set, the accept-charset attribute of the file upload widget form is used, if
available.
Additional form data to be sent along with the file uploads can be set using this option, which accepts an array of objects with name and value properties, a function returning such an array, a FormData object (for XHR file uploads), or a simple object.
The form of the first file input is given as parameter to the function.
Note: Additional form data is ignored when the multipart option is set to false.
Callback to retrieve the list of files from the server response.
Is given the data argument of the done callback, which contains the result property. Must return an array.
This option is a function that returns the current number of files selected and uploaded.
It is used in the maxNumberOfFiles validation.
Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function.
Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
Define if resized images should be cropped or only scaled.
If set to true, forces writing to and saving images from canvas, even if the original image fits the maximum image constraints.
The maximum height of resized images.
The maximum width of resized images.
The minimum height of resized images.
The minimum width of resized images.
Defines the image orientation (1-8) or takes the orientation value from Exif data if set to true.
Define the name of the property that the preview element is stored as on the File object.
Sets the quality parameter given to the canvas.toBlob() call when saving resized images.
Sets the type parameter given to the canvas.toBlob() call when saving resized images.
This option is only used by the iframe transport and allows to override the URL of the initial iframe src.
Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
Override the callback function name in a JSONP request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax requests, consider setting the jsonp property to false for security reasons.
Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.
To limit the number of concurrent uploads, set this option to an integer greater than 0.
This option limits the number of files uploaded with one XHR request to keep the request size under or equal to the defined limit in bytes.
Multipart file uploads add a number of bytes to each uploaded file, therefore this option adds an overhead for each file used in the limitMultiFileUploadSize configuration.
To limit the number of files uploaded with one XHR request, set this option to an integer greater than 0.
The regular expression for the types of audio files to load, matched against the file type.
The maximum file size of audio files to load.
The regular expression for the types of images to load, matched against the file type.
The maximum file size of images to load.
Don't revoke the object URL created to load the image.
The regular expression for the types of video files to load, matched against the file type.
The maximum file size of video files to load.
To upload large files in smaller chunks, set this option to a preferred maximum chunk size. If set to 0
,
null
or undefined
, or the browser does not support the required Blob API, files will be uploaded as a
whole.
For chunked uploads to work in Mozilla Firefox < 7, the multipart option has to be set to false
. This is
due to Gecko 2.0 (Firefox 4 etc.) adding blobs with an empty filename when building a multipart upload
request using the FormData interface (fixed in FF 7.0).
Several server-side frameworks (including PHP and Django) cannot handle multipart file uploads with empty filenames.
Note: If this option is enabled and singleFileUploads is set to false, only the first file of a selection will be uploaded.
The maximum allowed file size in bytes.
Note: This option has only an effect for browsers supporting the File API.
This option limits the number of files that are allowed to be uploaded using this widget.
By default, unlimited file uploads are allowed.
Note: The maxNumberOfFiles option depends on the getNumberOfFiles option, which is defined by the UI and AngularJS implementations.
The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
A mime type to override the XHR mime type.
The minimum allowed file size in bytes.
Note: This option has only an effect for browsers supporting the File API.
By default, XHR file uploads are sent as multipart/form-data.
The iframe transport is always using multipart/form-data.
If this option is set to false
, the file content is streamed to the server URL instead of sending a RFC
2388 multipart message for XMLHttpRequest file uploads. Non-multipart uploads are also referred to as HTTP
PUT file upload.
Note: Additional form data is ignored when the multipart option is set to false
. Non-multipart uploads
(multipart: false) are broken in Safari 5.1.
The parameter name for the file form data (the request argument name).
If undefined or empty, the name property of the file input field is used, or "files[]" if the file input name property is also empty.
A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
Callback for paste events to the drop zone collection.
The paste target jQuery object, by the default the complete document.
Set to a jQuery collection to enable paste support:
Set this option to the location of a postMessage API on the upload server, to enable cross-domain postMessage transport uploads.
By default, files are appended to the files container.
Set this option to true, to prepend files instead.
Define if preview images should be resized as canvas elements.
Define if preview images should be cropped or only scaled.
The maximum height of the preview images.
The maximum width of the preview images.
The minimum height of preview images.
The minimum width of preview images.
Defines the preview orientation (1-8) or takes the orientation value from Exif data if set to true.
Create the preview using the Exif data thumbnail.
Callback for the start of an individual file processing queue.
By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
A list of file processing actions.
Callback for the end (done or fail) of an individual file processing queue.
Callback for the successful end of an individual file processing queue.
Callback for the failure of an individual file processing queue.
Callback for the start of the fileupload processing queue.
Callback for the stop of the fileupload processing queue.
Callback for upload progress events.
Interval in milliseconds to calculate and trigger progress events.
Callback for global upload progress events.
By default, failed (abort or error) file uploads are removed from the global progress calculation. Set this
option to false
to prevent recalculating the global progress data.
Set this option to the location of a redirect URL on the origin server (the server that hosts the file upload form), for cross-domain iframe transport uploads.
If set, this value is sent as part of the form data to the upload server.
The upload server is supposed to redirect the browser to this URL after the upload completes and append the
upload information as URL encoded JSON string to the redirect URL, e.g., by replacing the %s
character
sequence.
The parameter name for the redirect url, sent as part of the form data and set to redirect
if this option
is empty.
By default, the file input field is replaced with a clone after each input field change event.
This is required for iframe transport queues and allows change events to be fired for the same file selection, but can be disabled by setting this option to false.
Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script.
Callback for the start of each file upload request.
If this callback returns false
, the file upload request is aborted.
The sent callback is the equivalent to the send callback and is triggered after the send callback has run and the files are about to be sent.
Set this option to true to issue all file upload requests in a sequential order.
By default, each file of a selection is uploaded using an individual request for XHR type uploads.
Set to false to upload file selections in one request each.
Callback for uploads start, equivalent to the global ajaxStart event (but for file upload requests only).
The started callback is the equivalent to the start callback and is triggered after the start callback has run and the transition effects called in the start callback have completed.
Note: Unlike the start callback, which is always called before all send callbacks, the started callback might be called after the sent callbacks, depending on the duration of the transition effects in those callbacks.
An object of numeric HTTP codes and functions to be called when the response has the corresponding code.
If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback.
Callback for uploads stop, equivalent to the global ajaxStop event (but for file upload requests only).
The stopped callback is the equivalent to the stop callback and is triggered after the stop callback has run and the transition effects called in the stop callback and all done callbacks have completed.
The stopped callback is therefore always triggered after each completed, failed and finished callback is done.
Callback for the submit event of each file upload.
If this callback returns false
, the file upload request is not started.
A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
Set this to true if you wish to use the traditional style of param serialization.
The HTTP request method for the file uploads.
"PUT" and "PATCH" are only supported by browser supporting XHR file uploads, as iframe transport uploads rely on standard HTML forms which only support "POST" file uploads.
If the type is defined as "PUT" or "PATCH", the iframe transport will send the files via "POST" and transfer the original method as "_method" URL parameter.
Note: As was noted above, it's a common practice to use "_method" to transfer the type of your request. For example, "Ruby on Rails" framework uses a hidden input with the name "_method" within each form, so it will likely override the value that you will set here.
The upload template function.
The ID of the upload template, given as parameter to the tmpl() method to set the uploadTemplate option.
When a non-multipart upload or a chunked multipart upload has been aborted, this option can be used to resume the upload by setting it to the size of the already uploaded bytes. This option is most useful when modifying the options object inside of the add or send callbacks, as the options are cloned for each file upload.
A string containing the URL to which the request is sent.
A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
Define the name of the property that the preview element is stored as on the File object.
An object of fieldName-fieldValue pairs to set on the native XHR object.
In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it.
A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter.
Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory.
Generated using TypeDoc
All the options that can be used to configure the file upload widget.