You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# jQuery XHR Upload Queue
2
2
3
-
jQuery plugin that creates a queued file uploading framework that implements [XMLHttpRequest Level 2](http://www.w3.org/TR/XMLHttpRequest/), the [FileAPI](http://www.w3.org/TR/FileAPI/), and the [Drag and Drop API](http://www.w3.org/TR/html5/dnd.html).
3
+
jQuery plugin that creates a queued file uploading framework that implements [XHR2](http://www.w3.org/TR/XMLHttpRequest/), the [FileAPI](http://www.w3.org/TR/FileAPI/), and the [Drag and Drop API](http://www.w3.org/TR/html5/dnd.html).
4
4
5
5
## Summary
6
-
This plugin creates a file uploading queue that will asynchronously upload files via the web browser using an XMLHttpRequest. It will automatically hook drag and drop events to accept file drops, form submit events (if the selected element is a form), and change events to any file select form fields found.
6
+
This plugin creates a file uploading queue that will asynchronously upload files via the web browser using an XMLHttpRequest. It will automatically hook drag and drop events to accept file drops, form submit events (if the selected element is a form), and change events to any file select form fields that it finds.
7
7
8
8
It is up to you to build the UI and implement the events via callbacks through the plugin.
9
9
@@ -17,7 +17,7 @@ It is up to you to build the UI and implement the events via callbacks through t
17
17
* Lightweight and memory efficient
18
18
* Works with large files
19
19
* No dependencies other than jQuery core (1.7+).
20
-
* Entirely free and open source.
20
+
* Entirely free and open source
21
21
22
22
## Usage
23
23
You'll find using this plugin a bit more complicated than some of the other options, since this plugin doesn't build the UI for you.
@@ -42,7 +42,7 @@ Here is a very basic example using the plugin:
* Setup the plugin on the `#myUploadForm` element, which in this example is a form.
81
+
* Setup the plugin on the `#uploadform` element, which in this example is a form.
83
82
* Set the `postUrl` option and the `queueAdd` callback.
84
83
* When a file is added to the queue (via file input or drag and drop) it will create a new `#uploaditem` div with the file name, upload status, and progress bar.
85
-
*It hooks the `progress`, `endSend`, and `sendFail` callbacks on the file to update the status text, progress bar, and alert the user when the upload finishes or fails.
84
+
*Hooks up the `progress`, `endSend`, and `sendFail` callbacks on the file to update the status text, progress bar, and alert the user when the upload finishes or fails.
86
85
87
-
Since `#myUploadForm` is a form, the plugin will hook the submit event to trigger the upload process so you don't have to set it up manually.
86
+
Since `#uploadform` is a form, the plugin will hook the submit event to trigger the upload process so you don't have to set it up manually.
88
87
89
88
## Options
90
89
### System Settings
@@ -123,10 +122,10 @@ Since `#myUploadForm` is a form, the plugin will hook the submit event to trigg
123
122
| processFileList | function(files) { return files; } | Function | Custom file pre-filtering code. This will get executed on the FileList before it gets filtered by the normal filters. This function must return an array of files to add to the queue. |
124
123
125
124
## Callback Details
126
-
The plugin makes all of its magic happen via callbacks. Wherever possible it tries for follow the jQuery pattern for naming and attaching callbacks. You will be placing your callbacks in the options object defined above.
125
+
The plugin makes all of its magic happen via callbacks. Wherever possible it tries for follow the jQuery pattern for naming and attaching callbacks.
127
126
128
127
### Plugin Callbacks
129
-
These callback are all either associated to the base plugin functions or its FileQueue functions. You set them directly in the options object passed to `xhrUpload()`.
128
+
These callback are all either associated to the base plugin functions or its FileQueue functions. You set them directly in the options object passed to `xhrUploadQueue()`.
130
129
131
130
***init()** This happens once for each matched element. This callback will only be invoked if the plugin has detected the browser features needed for full support.
132
131
***queueAdd(FileUpload)** This happens to every individual file added to the queue, and this is where most of your development will likely take place. It passes the FileUpload object of the file that has been added to the queue, exposing it so you can hook individual events for each file.
@@ -135,8 +134,8 @@ These callback are all either associated to the base plugin functions or its Fil
135
134
***uploadStart()** This callback is invoked when the process of sending the queued files begins.
136
135
***uploadFinish()** This callback is invoked when all files have finished uploading (even if they all failed or were aborted).
137
136
***handleUnacceptedFiles(FileUploads)** This callback is invoked when the user has attempted to add files that were not accepted because they are too large, not an accepted MIME type, the queue is full, or, if the ` silenceZeroByteErrors` option is set to false, when the file is zero bytes in size. It passes an array of FileUploads with the error property set to the appropriate FileError.
138
-
***noSupport()** This callback is invoked if the script has not detected the features necessary to operate. This can only happen once per `xhrUpload()` call, no matter how many matched elements were selected.
139
-
***processFileList(FileUploads)** This is a hook that allows you to do custom pre-filtering of the file list, before the list gets filtered by the regular size, MIME, and queue limit code. This callback must return the list of files that you want to have added to the queue.
137
+
***noSupport()** This callback is invoked if the script has not detected the features necessary to operate. This can only happen once per `xhrUploadQueue()` call, no matter how many matched elements were selected.
138
+
***processFileList(FileUploads)** This is a hook that allows you to do custom pre-filtering of the file list, before the list gets filtered by the regular size, MIME, and queue limit code. This callback must return an array of FileUploads that you want to have added to the queue.
140
139
141
140
### FileUpload Callbacks
142
141
Since file specific functionality is often unique to each individual file and file uploads a handled one file at a time, the callbacks are attached directly to the FileUpload object. This makes building the interface a little easier and lets you take better advantage of closures.
@@ -189,7 +188,7 @@ This object exposes several properties and methods that you will need to build y
189
188
***removeFromQueue()** Removes the file from the upload queue.
190
189
191
190
### FileError Enumeration
192
-
The FileError enum is attached to a FileUpload's error property when that file is not accepted into the queue. You can use this enumeration to check what caused the file to be rejected. It is public and available at `$.fn.xhrUpload.FileError`. It has the following values `QUEUE_FULL`, `FILE_TOO_LARGE`, `UNACCEPTED_MIME_TYPE`, and `ZERO_BYTE_FILE`.
191
+
The FileError enum is attached to a FileUpload's error property when that file is not accepted into the queue. You can use this enumeration to check what caused the file to be rejected. It is public and available at `$.fn.xhrUploadQueue.FileError`. It has the following values `QUEUE_FULL`, `FILE_TOO_LARGE`, `UNACCEPTED_MIME_TYPE`, and `ZERO_BYTE_FILE`.
193
192
194
193
## Browser Support
195
194
Full support for this plugin requires a browser that supports both FileAPI and XMLHttpRequest Level 2. Currently the browsers that meet the requirements for full support are Firefox, Chrome, Safari, Opera, Opera Mobile and Android Browser. Current versions of Internet Explorer, iOS Safari, and Opera Mini do not support the needed features. The next major version of Internet Explorer will support these features.
0 commit comments