Skip to content

Commit 6e1876b

Browse files
committed
2 parents dc0ef88 + 1eca245 commit 6e1876b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ var MyCtrl = [ '$scope', '$upload', function($scope, $upload) {
4646
$scope.onFileSelect = function($files) {
4747
//$files: an array of files selected, each file has name, size, and type.
4848
for (var i = 0; i < $files.length; i++) {
49-
var $file = $files[i];
49+
var file = $files[i];
5050
$scope.upload = $upload.upload({
5151
url: 'server/upload/url', //upload.php script, node.js route, or servlet url
5252
// method: POST or PUT,
5353
// headers: {'headerKey': 'headerValue'}, withCredential: true,
5454
data: {myObj: $scope.myModelObj},
55-
file: $file,
55+
file: file,
56+
// file: $files, //upload multiple files, this feature only works in HTML5 FromData browsers
5657
/* set file formData name for 'Content-Desposition' header. Default: 'file' */
5758
//fileFormDataName: myFile,
5859
/* customize how data is added to formData. See #40#issuecomment-28612000 for example */
@@ -70,13 +71,15 @@ var MyCtrl = [ '$scope', '$upload', function($scope, $upload) {
7071
}];
7172
```
7273

73-
Note: `angular.file-upload-shim.js` must be loaded before `angular.js` and is only needed if you are supporting non-HTML5 FormData browsers or you need the support for upload progress or cancel.
74+
**Note**: `angular.file-upload-shim.js` must be loaded before `angular.js` and is only needed if you are supporting non-HTML5 FormData browsers or you need the support for upload progress or cancel.
7475

76+
**Upload multiple files**: Only for HTML5 FormData browsers (not IE8-9) if you pass an array of files to `file` option it will upload all of them together in one request. The formData file name will have the index appended to it (i.e. `file0`, `file1`, etc.). If you want it cross browser you need to iterate through files and upload them one by one like the code above.
7577

7678
## Old browsers
7779

7880
For browsers not supporting HTML5 FormData (IE8, IE9, ...) [FileAPI](https://github.com/mailru/FileAPI) module is used.
7981
For these browsers these two files are needed: **`FileAPI.min.js`, `FileAPI.flash.swf`** which will be loaded if the browser does not supports HTML5 FormData (no extra load for HTML5 browsers).
82+
8083
**Note**: Flash needs to be installed on the client browser since `FileAPI` uses Flash to upload files.
8184

8285
You can put these two files beside `angular-file-upload-shim(.min).js` on your server to be loaded automatically on demand or use the following script to set the FileAPI load path (optional):
@@ -88,7 +91,7 @@ You can put these two files beside `angular-file-upload-shim(.min).js` on your s
8891
staticPath: '/flash/FileAPI.flash.swf/folder/'
8992
}
9093
</script>
91-
<script src="angular.file-upload-shim.min.js"></script>...
94+
<script src="angular-file-upload-shim.min.js"></script>...
9295
```
9396

9497
## Install

0 commit comments

Comments
 (0)