Skip to content

Commit 384bc59

Browse files
committed
multiple files for HTML5 browsers danialfarid#69
1 parent 7aaed51 commit 384bc59

12 files changed

+33
-15
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "angularjs-file-upload",
33
"main": "angular-file-upload.min.js",
4-
"version": "1.1.10",
4+
"version": "1.1.11",
55
"homepage": "https://github.com/danialfarid/angular-file-upload",
66
"authors": [
77
"Danial Farid <danial.farid@gmail.com>"

demo/war/js/angular-file-upload-html5-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**!
22
* AngularJS file upload shim for angular XHR HTML5 browsers
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 1.1.10
4+
* @version 1.1.11
55
*/
66
if (window.XMLHttpRequest) {
77
if (window.FormData) {

demo/war/js/angular-file-upload-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**!
22
* AngularJS file upload shim for HTML5 FormData
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 1.1.10
4+
* @version 1.1.11
55
*/
66
(function() {
77

demo/war/js/angular-file-upload.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**!
22
* AngularJS file upload/drop directive with http post and progress
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 1.1.10
4+
* @version 1.1.11
55
*/
66
(function() {
77

@@ -35,7 +35,16 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
3535
}
3636
}
3737
config.transformRequest = angular.identity;
38-
formData.append(config.fileFormDataName || 'file', config.file, config.file.name);
38+
39+
var fileFromName = config.fileFormDataName || 'file';
40+
41+
if (Object.prototype.toString.call(config.file) === '[object Array]') {
42+
for (var i = 0; i < config.file.length; i++) {
43+
formData.append(fileFromName + i, config.file[i], config.file[i].name);
44+
}
45+
} else {
46+
formData.append(fileFromName, config.file, config.file.name);
47+
}
3948

4049
formData['__setXHR_'] = function(xhr) {
4150
config.__XHR = xhr;

dist/angular-file-upload-html5-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**!
22
* AngularJS file upload shim for angular XHR HTML5 browsers
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 1.1.10
4+
* @version 1.1.11
55
*/
66
if (window.XMLHttpRequest) {
77
if (window.FormData) {

dist/angular-file-upload-html5-shim.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-file-upload-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**!
22
* AngularJS file upload shim for HTML5 FormData
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 1.1.10
4+
* @version 1.1.11
55
*/
66
(function() {
77

dist/angular-file-upload-shim.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-file-upload.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**!
22
* AngularJS file upload/drop directive with http post and progress
33
* @author Danial <danial.farid@gmail.com>
4-
* @version 1.1.10
4+
* @version 1.1.11
55
*/
66
(function() {
77

@@ -35,7 +35,16 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
3535
}
3636
}
3737
config.transformRequest = angular.identity;
38-
formData.append(config.fileFormDataName || 'file', config.file, config.file.name);
38+
39+
var fileFromName = config.fileFormDataName || 'file';
40+
41+
if (Object.prototype.toString.call(config.file) === '[object Array]') {
42+
for (var i = 0; i < config.file.length; i++) {
43+
formData.append(fileFromName + i, config.file[i], config.file[i].name);
44+
}
45+
} else {
46+
formData.append(fileFromName, config.file, config.file.name);
47+
}
3948

4049
formData['__setXHR_'] = function(xhr) {
4150
config.__XHR = xhr;

dist/angular-file-upload.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)