Skip to content

Commit b7e314a

Browse files
committed
1 parent fa1f9bc commit b7e314a

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

dist/angular-file-upload-shim.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ if (!window.FormData) {
139139
var wrapFileApi = function(elem) {
140140
if (!elem.__isWrapped && (elem.getAttribute('ng-file-select') != null || elem.getAttribute('data-ng-file-select') != null)) {
141141
var wrap = document.createElement('div');
142-
wrap.innerHTML = '<div class="js-fileapi-wrapper" /*style="position:relative; overflow:hidden"*/></div>';
142+
wrap.innerHTML = '<div class="js-fileapi-wrapper" style="position:relative; overflow:hidden"></div>';
143143
wrap = wrap.firstChild;
144144
var parent = elem.parentNode;
145145
parent.insertBefore(wrap, elem);
@@ -205,12 +205,15 @@ if (!window.FormData) {
205205

206206
(function () {
207207
//load FileAPI
208-
if (!window.FileAPI || !FileAPI.upload) {
209-
var base = '', jsUrl = null, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
210-
if (window.FileAPI && window.FileAPI.jsPath) {
211-
base = window.FileAPI.jsPath;
212-
} else if (window.FileAPI && window.FileAPI.jsUrl){
213-
jsUrl = window.FileAPI.jsUrl
208+
if (!window.FileAPI) {
209+
window.FileAPI = {};
210+
}
211+
if (!FileAPI.upload) {
212+
var jsUrl, basePath, script = document.createElement('script'), allScripts = document.getElementsByTagName('script'), i, index, src;
213+
if (window.FileAPI.jsUrl) {
214+
jsUrl = window.FileAPI.jsUrl;
215+
} else if (window.FileAPI.jsPath) {
216+
basePath = window.FileAPI.jsPath;
214217
} else {
215218
for (i = 0; i < allScripts.length; i++) {
216219
src = allScripts[i].src;
@@ -219,25 +222,21 @@ if (!window.FormData) {
219222
index = src.indexOf('angular-file-upload-shim.min.js');
220223
}
221224
if (index > -1) {
222-
base = src.substring(0, index);
225+
basePath = src.substring(0, index);
223226
break;
224227
}
225228
}
226229
}
227230

228-
if (!window.FileAPI || FileAPI.staticPath == null) {
229-
FileAPI = {
230-
staticPath: base
231-
}
232-
}
233-
234-
script.setAttribute('src', jsUrl || base + "FileAPI.min.js");
231+
if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
232+
FileAPI.debug = true;
233+
script.setAttribute('src', jsUrl || basePath + "FileAPI.min.js");
235234
document.getElementsByTagName('head')[0].appendChild(script);
236235
}
237236
})();
238237
}
239238

240-
/*
239+
241240
if (!window.FileReader) {
242241
window.FileReader = function() {
243242
var _this = this, loadStarted = false;
@@ -285,7 +284,7 @@ if (!window.FileReader) {
285284
}
286285
};
287286
this.readAsArrayBuffer = function(file) {
288-
FileAPI.readAsArrayBuffer(file, listener);
287+
FileAPI.readAsBinaryString(file, listener);
289288
}
290289
this.readAsBinaryString = function(file) {
291290
FileAPI.readAsBinaryString(file, listener);
@@ -298,5 +297,5 @@ if (!window.FileReader) {
298297
}
299298
}
300299
}
301-
*/
300+
302301
})();

dist/angular-file-upload-shim.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-file-upload.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ angularFileUpload.service('$upload', ['$http', '$rootScope', '$timeout', functio
5858
promise.then = (function(promise, origThen) {
5959
return function(s, e, p) {
6060
config.progress = p || config.progress;
61-
return origThen.apply(promise, [s, e, p]);
61+
var result = origThen.apply(promise, [s, e, p]);
62+
result.abort = promise.abort;
63+
result.progress = promise.progress;
64+
return result;
6265
};
6366
})(promise, promise.then);
6467

dist/angular-file-upload.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)