Skip to content

Commit

Permalink
multiple files for HTML5 browsers #69
Browse files Browse the repository at this point in the history
  • Loading branch information
danialfarid committed Dec 13, 2013
1 parent 7aaed51 commit 384bc59
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angularjs-file-upload",
"main": "angular-file-upload.min.js",
"version": "1.1.10",
"version": "1.1.11",
"homepage": "https://github.com/danialfarid/angular-file-upload",
"authors": [
"Danial Farid <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion demo/war/js/angular-file-upload-html5-shim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload shim for angular XHR HTML5 browsers
* @author Danial <[email protected]>
* @version 1.1.10
* @version 1.1.11
*/
if (window.XMLHttpRequest) {
if (window.FormData) {
Expand Down
2 changes: 1 addition & 1 deletion demo/war/js/angular-file-upload-shim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload shim for HTML5 FormData
* @author Danial <[email protected]>
* @version 1.1.10
* @version 1.1.11
*/
(function() {

Expand Down
13 changes: 11 additions & 2 deletions demo/war/js/angular-file-upload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload/drop directive with http post and progress
* @author Danial <[email protected]>
* @version 1.1.10
* @version 1.1.11
*/
(function() {

Expand Down Expand Up @@ -35,7 +35,16 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
}
}
config.transformRequest = angular.identity;
formData.append(config.fileFormDataName || 'file', config.file, config.file.name);

var fileFromName = config.fileFormDataName || 'file';

if (Object.prototype.toString.call(config.file) === '[object Array]') {
for (var i = 0; i < config.file.length; i++) {
formData.append(fileFromName + i, config.file[i], config.file[i].name);
}
} else {
formData.append(fileFromName, config.file, config.file.name);
}

formData['__setXHR_'] = function(xhr) {
config.__XHR = xhr;
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload-html5-shim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload shim for angular XHR HTML5 browsers
* @author Danial <[email protected]>
* @version 1.1.10
* @version 1.1.11
*/
if (window.XMLHttpRequest) {
if (window.FormData) {
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload-html5-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/angular-file-upload-shim.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload shim for HTML5 FormData
* @author Danial <[email protected]>
* @version 1.1.10
* @version 1.1.11
*/
(function() {

Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions dist/angular-file-upload.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**!
* AngularJS file upload/drop directive with http post and progress
* @author Danial <[email protected]>
* @version 1.1.10
* @version 1.1.11
*/
(function() {

Expand Down Expand Up @@ -35,7 +35,16 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
}
}
config.transformRequest = angular.identity;
formData.append(config.fileFormDataName || 'file', config.file, config.file.name);

var fileFromName = config.fileFormDataName || 'file';

if (Object.prototype.toString.call(config.file) === '[object Array]') {
for (var i = 0; i < config.file.length; i++) {
formData.append(fileFromName + i, config.file[i], config.file[i].name);
}
} else {
formData.append(fileFromName, config.file, config.file.name);
}

formData['__setXHR_'] = function(xhr) {
config.__XHR = xhr;
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-file-upload.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nuget/Package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>angular-file-upload</id>
<title>Angular file upload</title>
<version>1.1.10.1</version>
<version>1.1.11</version>
<authors>Danial Farid, Georgios Diamantopoulos (nuget package)</authors>
<owners>Danial Farid</owners>
<licenseUrl>https://github.com/danialfarid/angular-file-upload/blob/master/LICENSE</licenseUrl>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-file-upload",
"version": "1.1.10",
"version": "1.1.11",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.7",
Expand Down

0 comments on commit 384bc59

Please sign in to comment.