Skip to content

Commit

Permalink
fixed #171
Browse files Browse the repository at this point in the history
  • Loading branch information
danialfarid committed Mar 26, 2014
1 parent 389e857 commit 6b70ad7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions demo/war/js/angular-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ angularFileUpload.service('$upload', ['$http', '$timeout', function($http, $time
formData.append(key, val);
}
}
}

if (config.file != null) {
var fileFormName = config.fileFormDataName || 'file';
if (config.file != null) {
var fileFormName = config.fileFormDataName || 'file';

if (Object.prototype.toString.call(config.file) === '[object Array]') {
var isFileFormNameString = Object.prototype.toString.call(fileFormName) === '[object String]';
for (var i = 0; i < config.file.length; i++) {
formData.append(isFileFormNameString ? fileFormName + i : fileFormName[i], config.file[i], config.file[i].name);
}
} else {
formData.append(fileFormName, config.file, config.file.name);
if (Object.prototype.toString.call(config.file) === '[object Array]') {
var isFileFormNameString = Object.prototype.toString.call(fileFormName) === '[object String]';
for (var i = 0; i < config.file.length; i++) {
formData.append(isFileFormNameString ? fileFormName + i : fileFormName[i], config.file[i], config.file[i].name);
}
} else {
formData.append(fileFormName, config.file, config.file.name);
}
}
return formData;
Expand Down
18 changes: 9 additions & 9 deletions dist/angular-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,18 @@ angularFileUpload.service('$upload', ['$http', '$timeout', function($http, $time
formData.append(key, val);
}
}
}

if (config.file != null) {
var fileFormName = config.fileFormDataName || 'file';
if (config.file != null) {
var fileFormName = config.fileFormDataName || 'file';

if (Object.prototype.toString.call(config.file) === '[object Array]') {
var isFileFormNameString = Object.prototype.toString.call(fileFormName) === '[object String]';
for (var i = 0; i < config.file.length; i++) {
formData.append(isFileFormNameString ? fileFormName + i : fileFormName[i], config.file[i], config.file[i].name);
}
} else {
formData.append(fileFormName, config.file, config.file.name);
if (Object.prototype.toString.call(config.file) === '[object Array]') {
var isFileFormNameString = Object.prototype.toString.call(fileFormName) === '[object String]';
for (var i = 0; i < config.file.length; i++) {
formData.append(isFileFormNameString ? fileFormName + i : fileFormName[i], config.file[i], config.file[i].name);
}
} else {
formData.append(fileFormName, config.file, config.file.name);
}
}
return formData;
Expand Down
2 changes: 1 addition & 1 deletion dist/angular-file-upload.min.js

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

0 comments on commit 6b70ad7

Please sign in to comment.