Skip to content

Commit af209e6

Browse files
committed
adding a new FileAPI property, fullUrl, to specify location of FileAPI library
1 parent d181b0b commit af209e6

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ You can put these two files beside `angular-file-upload-shim(.min).js` on your s
9898
</script>
9999
<script src="angular-file-upload-shim.min.js"></script>...
100100
```
101+
If you are using a CDN to host your files you can aslso specify the specific location of FileAPI.min.js and FileAPI.flash.swf by using fullUrl and flashUrl:
102+
```html
103+
<script>
104+
FileAPI = {
105+
fullUrl: 'yourcdn.com/js/FileAPI.min.js',
106+
flashUrl: 'yourcdn.com/js/FileAPI.flash.swf'
107+
}
108+
</script>
109+
<script src="angular-file-upload-shim.min.js"></script>...
110+
```
101111

102112
## Install
103113

dist/angular-file-upload-shim.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ if (!window.FormData) {
206206
(function () {
207207
//load FileAPI
208208
if (!window.FileAPI || !FileAPI.upload) {
209-
var base = '', script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
209+
var base = '', fullUrl = false, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
210210
if (window.FileAPI && window.FileAPI.jsPath) {
211211
base = window.FileAPI.jsPath;
212+
} else if (window.FileAPI && window.FileAPI.fullUrl){
213+
fullUrl = window.FileAPI.fullUrl
212214
} else {
213215
for (i = 0; i < allScripts.length; i++) {
214216
src = allScripts[i].src;
@@ -229,7 +231,9 @@ if (!window.FormData) {
229231
}
230232
}
231233

232-
script.setAttribute('src', base + "FileAPI.min.js");
234+
fullUrl = fullUrl || base + "FileAPI.min.js";
235+
236+
script.setAttribute('src', fullUrl);
233237
document.getElementsByTagName('head')[0].appendChild(script);
234238
}
235239
})();

0 commit comments

Comments
 (0)