blueimp/jQuery-File-Upload — Issue #747: maxFileSize limit reached, causes fatal jQuery error
Author: joshpangell
Created: 2011-11-02 18:35:14+00:00
State: open

I ran into an issue when uploading with the following options

```javascript
autoUpload: true,
singleFileUploads: true,
maxFileSize: 6291456,
sequentialUploads : true,
```

When a group of images was uploaded and one of these images was larger then the allowed file size, a fatal jQuery error was fired:

TypeError: 'abort' is not a valid argument for 'Function.prototype.apply' (evaluating 'a.shift().apply')

There appears to be an issue with the way the args parameter is being passed to the jQuery **deferred.rejectWith()** method. This method is expecting an array to be passed as an arg, but the upload code is not passing an array.

To solve this, I changed the arg to pass an array, instead of the var.

```javascript
_getXHRPromise: function (resolveOrReject, context, args) {
var dfd = $.Deferred(),
promise = dfd.promise();
context = context || this.options.context || promise;
if (resolveOrReject === true) {
dfd.resolveWith(context, [args]);
} else if (resolveOrReject === false) {
dfd.rejectWith(context, [args]);
}
promise.abort = dfd.promise;
return this._enhancePromise(promise);
}
```

This issue seems to be resolved now. I am posting this in case others have this issue, or the source code can get updated.