diff --git a/README.md b/README.md
index f124fb28..15ada4c1 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ Lightweight Angular JS directive to upload files. Features:
* Supports cancel/abort upload while in progress
* Supports File drag and drop (HTML5 only)
* Supports Directory drag and drop (webkit only)
+* Supports CORS
* All non-HTML5 code is in a separate shim file and could be easily removed if you only supports HTML5. (It is needed for progress event though)
* Flash FileAPI will be loaded on demand for non-HTML5 FormData browsers so no extra load for HTML5 browsers.
* `$upload` method can be configured to be either `POST` or `PUT` for HTML5 browsers.
@@ -82,16 +83,15 @@ var MyCtrl = [ '$scope', '$upload', function($scope, $upload) {
**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 to support upload progress or cancel.
-**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. In this case the `fileFormDataName` could be an array of names or a single string. If you use a single string, you may want to append square brackets to the end (i.e. `file[]`), depending on how your server parses arguments.
-
+**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. In this case the `fileFormDataName` could be an array of names or a single string. For Rails or depending on your server append square brackets to the end (i.e. `file[]`).
If you want a cross browser approach you need to iterate through files and upload them one by one like the code above. This is due to the limitation of Flash file upload.
-You can also use `$upload.http()` to send the file binary or any data to the server while being able to listen to progress event. See [#88](https://github.com/danialfarid/angular-file-upload/issues/88) for more details.
+**$upload.http()**: You can also use `$upload.http()` to send the file binary or any data to the server while being able to listen to progress event. See [#88](https://github.com/danialfarid/angular-file-upload/issues/88) for more details.
This equivalent to angular $http() but allow you to listen to progress event for HTML5 browsers.
-If your server is Rails and Apache you may need to modify server configurations for the server to support upload progress. See [#207](https://github.com/danialfarid/angular-file-upload/issues/207)
+**Rails progress event**: If your server is Rails and Apache you may need to modify server configurations for the server to support upload progress. See [#207](https://github.com/danialfarid/angular-file-upload/issues/207)
-For file drag and drop, ng-file-drag-over-class can be a function that returns a class name based on the $event. See the demo for a sample. If the attribute is not specified by default the element will have "dragover" class on drag over which could be used to style the drop zone.
+**ng-file-drag-over-class**: For file drag and drop, ng-file-drag-over-class can be a function that returns a class name based on the $event. See the demo for a sample. If the attribute is not specified by default the element will have "dragover" class on drag over which could be used to style the drop zone.
## Old browsers
@@ -112,15 +112,23 @@ You can put these two files beside `angular-file-upload-shim(.min).js` on your s
//only one of staticPath or flashUrl.
staticPath: '/flash/FileAPI.flash.swf/folder/'
flashUrl: 'yourcdn.com/js/FileAPI.flash.swf'
+
+ //to debug flash in HTML5 browsers
+ //forceLoad: true, html5: false
}
...
```
-**Note**: Because of the Flash limitation/bug there need to be a response body coming back from the server in order for the success and error callbacks to work properly. See [163#issuecomment](https://github.com/danialfarid/angular-file-upload/issues/163#issuecomment-39839508)
+**Known issues**:
+*Because of the Flash limitation/bug there need to be a response body coming back from the server in order for the success and error callbacks to work properly. See [163#issuecomment](https://github.com/danialfarid/angular-file-upload/issues/163#issuecomment-39839508)
+*Custom headers will not work due to Flash limitation [#111](https://github.com/danialfarid/angular-file-upload/issues/111) [#224](https://github.com/danialfarid/angular-file-upload/issues/224) [#129](https://github.com/danialfarid/angular-file-upload/issues/129)
##Amazon S3 Upload
[nukulb](https://github.com/nukulb) has provided an example here https://github.com/hubba/s3-angular-file-upload
+##Node.js
+Sample wiki page provided by [chovy](https://github.com/chovy)
+
## Install
Download latest release from [here](https://github.com/danialfarid/angular-file-upload-bower/releases) or
diff --git a/demo/src/com/df/angularfileupload/CORSFilter.java b/demo/src/com/df/angularfileupload/CORSFilter.java
new file mode 100644
index 00000000..5ae6802b
--- /dev/null
+++ b/demo/src/com/df/angularfileupload/CORSFilter.java
@@ -0,0 +1,38 @@
+package com.df.angularfileupload;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class CORSFilter implements Filter {
+
+ @Override
+ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException,
+ ServletException {
+ HttpServletResponse httpResp = (HttpServletResponse) resp;
+ HttpServletRequest httpReq = (HttpServletRequest) req;
+
+ httpResp.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, OPTION");
+ httpResp.setHeader("Access-Control-Allow-Origin", "*");
+ if (httpReq.getMethod().equalsIgnoreCase("OPTIONS")) {
+ httpResp.setHeader("Access-Control-Allow-Headers",
+ ((HttpServletRequest) req).getHeader("Access-Control-Request-Headers"));
+ }
+ chain.doFilter(req, resp);
+ }
+
+ @Override
+ public void init(FilterConfig arg0) throws ServletException {
+ }
+
+ @Override
+ public void destroy() {
+ }
+}
\ No newline at end of file
diff --git a/demo/war/WEB-INF/appengine-web.xml b/demo/war/WEB-INF/appengine-web.xml
index b0671aa9..47372ef0 100644
--- a/demo/war/WEB-INF/appengine-web.xml
+++ b/demo/war/WEB-INF/appengine-web.xml
@@ -1,7 +1,7 @@
angular-file-upload
- 1-5-0
+ 1-6-0
+
+
+
diff --git a/demo/war/WEB-INF/web.xml b/demo/war/WEB-INF/web.xml
index 45a9cb60..9c71eafa 100644
--- a/demo/war/WEB-INF/web.xml
+++ b/demo/war/WEB-INF/web.xml
@@ -1,4 +1,7 @@
-
+
+file_uploadcom.df.angularfileupload.FileUpload
@@ -10,16 +13,24 @@
index.html
-
- SystemServiceServlet
- com.google.api.server.spi.SystemServiceServlet
-
- services
-
-
-
-
- SystemServiceServlet
- /_ah/spi/*
-
+
+ SystemServiceServlet
+ com.google.api.server.spi.SystemServiceServlet
+
+ services
+
+
+
+
+ SystemServiceServlet
+ /_ah/spi/*
+
+
+ cors_filter
+ com.df.angularfileupload.CORSFilter
+
+
+ cors_filter
+ *
+
\ No newline at end of file
diff --git a/demo/war/common.css b/demo/war/common.css
index 78909a9b..8dee808f 100644
--- a/demo/war/common.css
+++ b/demo/war/common.css
@@ -2,16 +2,28 @@ body {
font-family: Helvetica, arial, freesans, clean, sans-serif;
}
-input[type="file"] {
+.upload-buttons input[type="file"] {
width: 6.3em \0/IE9;
height: 1.5em;
margin: 5px;
}
-input[multiple] {
+.upload-buttons input[multiple] {
width: 6.2em \0/IE9;
}
+.upload-button {
+ width: 160px;
+ Height: 30px;
+ display: inline-block;
+ line-height: 30px;
+ padding: 0 10px;
+ background: #CCC;
+ appearance: button;
+ -moz-appearance: button; /* Firefox */
+ -webkit-appearance: button; /* Safari and Chrome */
+}
+
.sel-file {
padding: 1px 5px;
font-size: smaller;
diff --git a/demo/war/crossdomain.xml b/demo/war/crossdomain.xml
index 799bbdae..73653266 100644
--- a/demo/war/crossdomain.xml
+++ b/demo/war/crossdomain.xml
@@ -1,4 +1,8 @@
-
+
+
+
+
+
\ No newline at end of file
diff --git a/demo/war/index.html b/demo/war/index.html
index 73e453d0..671b7cf9 100644
--- a/demo/war/index.html
+++ b/demo/war/index.html
@@ -4,15 +4,28 @@
Angular file upload sample
+
-
@@ -25,19 +38,23 @@