Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08a5d5c

Browse files
committed
Trigger aborts of unstarted file uploads in the core plugin. Closes blueimp#2751
1 parent 263e217 commit 08a5d5c

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

blueimp-file-upload.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.3.0",
3+
"version": "9.4.0",
44
"title": "jQuery File Upload",
55
"author": {
66
"name": "Sebastian Tschan",

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.3.0",
3+
"version": "9.4.0",
44
"title": "jQuery File Upload",
55
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
66
"keywords": [

js/jquery.fileupload-angular.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload AngularJS Plugin 2.0.1
2+
* jQuery File Upload AngularJS Plugin 2.1.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2013, Sebastian Tschan
@@ -69,7 +69,6 @@
6969
return data.submit();
7070
};
7171
file.$cancel = function () {
72-
scope.clear(files);
7372
return data.abort();
7473
};
7574
},
@@ -134,11 +133,13 @@
134133
if (e.isDefaultPrevented()) {
135134
return false;
136135
}
137-
var that = this;
136+
var that = this,
137+
scope = data.scope();
138138
if (data.errorThrown === 'abort') {
139+
scope.clear(data.files);
139140
return;
140141
}
141-
data.scope().$apply(function () {
142+
scope.$apply(function () {
142143
data.handleResponse.call(that, e, data);
143144
});
144145
},

js/jquery.fileupload-ui.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload User Interface Plugin 9.0.0
2+
* jQuery File Upload User Interface Plugin 9.4.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -517,12 +517,12 @@
517517
var template = $(e.currentTarget)
518518
.closest('.template-upload,.template-download'),
519519
data = template.data('data') || {};
520-
if (!data.jqXHR) {
521-
data.context = data.context || template;
520+
data.context = data.context || template;
521+
if (data.abort) {
522+
data.abort();
523+
} else {
522524
data.errorThrown = 'abort';
523525
this._trigger('fail', e, data);
524-
} else {
525-
data.jqXHR.abort();
526526
}
527527
},
528528

js/jquery.fileupload.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload Plugin 5.38.0
2+
* jQuery File Upload Plugin 5.39.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2010, Sebastian Tschan
@@ -651,7 +651,8 @@
651651
return this.jqXHR.abort();
652652
}
653653
this.errorThrown = 'abort';
654-
return that._getXHRPromise();
654+
that._trigger('fail', null, this);
655+
return that._getXHRPromise(false);
655656
};
656657
data.state = function () {
657658
if (this.jqXHR) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blueimp-file-upload",
3-
"version": "9.3.0",
3+
"version": "9.4.0",
44
"title": "jQuery File Upload",
55
"description": "File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.",
66
"keywords": [

0 commit comments

Comments
 (0)