-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d93eab
commit 6fa27c2
Showing
1 changed file
with
10 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ New in version 1.0.0: | |
|
||
**Click here for <a href="http://angular-file-upload.appspot.com/" target="_blank">DEMO</a>** | ||
|
||
Lightweight Angular JS directive to upload files using regular input type file and ajax call. | ||
Lightweight Angular JS directive to upload files using regular input type file or drag&drop file and ajax call. | ||
|
||
HTML: | ||
```html | ||
|
@@ -50,27 +50,24 @@ var MyCtrl = [ '$scope', '$http', function($scope, $http) { | |
``` | ||
|
||
|
||
You also need **FileAPI.min.js** and **FileAPI.flash.swf** files as polyfill using Flash for browsers that does not support HTML5 FormData (i.e. IE8-9). | ||
For HTML5 FromData supported browsers they will be ignored (not loaded). | ||
**Note**: For IE8 on XP Flash needs to be installed. | ||
For the browsers not supporting HTML5 FormData you need [FileAPI](https://github.com/mailru/FileAPI) files **FileAPI.min.js** and **FileAPI.flash.swf** as a polyfill. These files will not be loaded to the client if the browser supports HTML5 FormData (no extra load). | ||
**Note**: Flash needs to be installed on the client browser if it doesn't support HTML5. | ||
|
||
The js file **FileAPI.min.js** must be placed beside angular-file-upload.js. If the swf file **FileAPI.flash.swf** is placed in another directory on the server do the following step, unless they will be automatically loaded from the same location as angular-file-upload.js. | ||
You can put **FileAPI.min.js** and flash files beside angular-file-upload.js on your server so they will be loaded automatically. Alternatively you can use the following script to set the FileAPI load path: | ||
```script | ||
<script> | ||
FileAPI = { | ||
staticPath: "/flash/path/to/fileapi/swf/" //the path to load swf file (optional) | ||
jsPath: "/js/path/to/FileAPI.min.js, | ||
staticPath: "/flash/path/to/FileAPI.flash.swf" | ||
} | ||
</script> | ||
``` | ||
This code needs to be before `<script src="angular-file-upload.js"></script>` | ||
|
||
For browsers not supporting HTML5 FormData, [FileAPI](https://github.com/mailru/FileAPI) polyfill is used to upload file with Flash. Two extra files will be loaded for these browsers: FileAPI.min.js and FileAPI.flash.swf. | ||
If JQuery is not included in your page then it will be loaded from google CDN for those browsers. | ||
This needs to be loaded before angular-file-upload.js (place before `<script src="angular-file-upload.js"></script>`) | ||
|
||
You can find the sample server code in Java/GAE [here](https://github.com/danialfarid/angular-file-upload/blob/master/src/com/df/angularfileupload/FileUpload.java). | ||
|
||
If you wish to use CDN to include the script files you can use this CDN: [http//cdn.jsdelivr.net/angular.file-upload/1.0.0/angular-file-upload.js](//cdn.jsdelivr.net/angular.file-upload/1.0.0/angular-file-upload.js) | ||
If you use this CDN you need to add a crossdomain.xml file to your root server in order for the Adbobe Flash to be able to upload the file for browsers not supporting FormData. | ||
If you wish to use CDN to include the script files you can use this CDN: [http//cdn.jsdelivr.net/angular.file-upload/1.0.2/angular-file-upload.js](//cdn.jsdelivr.net/angular.file-upload/1.0.2/angular-file-upload.js) | ||
If you use this CDN you need to add a crossdomain.xml file to your root server in order for the Adbobe Flash to be able to upload the file for browsers not supporting FormData. | ||
|
||
crossdomain.xml (Only needed if you are using CDN instead of having the js/swf files on your server) | ||
```crossdomain.xml | ||
|
@@ -81,7 +78,7 @@ crossdomain.xml (Only needed if you are using CDN instead of having the js/swf f | |
``` | ||
|
||
If you use this module you can give it a thumbs up at [http://ngmodules.org/modules/angular-file-upload](http://ngmodules.org/modules/angular-file-upload). | ||
The module is registered at bower with the name **"angularjs-file-upload"** (notice 'js' after angular): bower install angularjs-file-upload#1.0.0 | ||
The module is registered at bower with the name **"angularjs-file-upload"** (notice 'js' after angular): bower install angularjs-file-upload#1.0.2 | ||
|
||
Let [me](mailto:[email protected]) know if you see any bug or open an [issue](https://github.com/danialfarid/angular-file-upload/issues). | ||
|
||
|