Skip to content

Commit

Permalink
a fix for #1071, #1071
Browse files Browse the repository at this point in the history
  • Loading branch information
Danial Farid authored and Danial Farid committed Oct 22, 2015
1 parent 6c2508f commit 633be83
Show file tree
Hide file tree
Showing 24 changed files with 66 additions and 76 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Table of Content:
* supports CORS and direct upload of file's binary data using `Upload.$http()`
* plenty of sample server side code, available on nuget
* on demand flash [FileAPI](https://github.com/mailru/FileAPI) shim loading no extra load for html5 browsers.
* HTML5 FileReader shim for IE8-9
* HTML5 FileReader.readAsDataURL shim for IE8-9

##<a name="install"></a> Install

Expand Down
2 changes: 1 addition & 1 deletion demo/src/main/webapp/js/FileAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@
}
}
else {
_emit(file, fn, 'error', undef, { error: 'filreader_not_support_'+as });
_emit(file, fn, 'error', undef, { error: 'FileReader_not_support_'+as });
}
}

Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/webapp/js/FileAPI.min.js

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions demo/src/main/webapp/js/ng-file-upload-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* progress, resize, thumbnail, preview, validation and CORS
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <danial.farid@gmail.com>
* @version 9.1.0
* @version 9.1.1
*/

(function () {
Expand Down Expand Up @@ -294,7 +294,7 @@
}

if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js');
script.setAttribute('src', jsUrl || basePath + 'FileAPI.js');
document.getElementsByTagName('head')[0].appendChild(script);
}

Expand Down Expand Up @@ -408,12 +408,6 @@ if (!window.FileReader) {
_this.dispatchEvent(e);
}
};
this.readAsArrayBuffer = function (file) {
FileAPI.readAsBinaryString(file, listener);
};
this.readAsBinaryString = function (file) {
FileAPI.readAsBinaryString(file, listener);
};
this.readAsDataURL = function (file) {
FileAPI.readAsDataURL(file, listener);
};
Expand All @@ -427,7 +421,7 @@ if (!window.FileReader) {
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
* progress, resize, thumbnail, preview, validation and CORS
* @author Danial <danial.farid@gmail.com>
* @version 9.1.0
* @version 9.1.1
*/

if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
Expand All @@ -448,7 +442,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {

var ngFileUpload = angular.module('ngFileUpload', []);

ngFileUpload.version = '9.1.0';
ngFileUpload.version = '9.1.1';

ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
var upload = this;
Expand Down Expand Up @@ -948,7 +942,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
files = valids;
}
var fixOrientation = upload.emptyPromise(files);
if (upload.attrGetter('ngfFixOrientation', attr, scope) !== false) {
if (upload.attrGetter('ngfFixOrientation', attr, scope) !== false && upload.isExifSupported()) {
fixOrientation = applyExifRotations(files);
}
fixOrientation.then(function () {
Expand Down Expand Up @@ -2302,6 +2296,10 @@ ngFileUpload.service('UploadExif', ['UploadResize', '$q', function (UploadResize

}

upload.isExifSupported = function() {
return window.FileReader && new FileReader().readAsArrayBuffer && upload.isResizeSupported();
};

upload.orientation = function (file) {
if (file.$ngfOrientation != null) {
return upload.emptyPromise(file.$ngfOrientation);
Expand Down
6 changes: 3 additions & 3 deletions demo/src/main/webapp/js/ng-file-upload-all.min.js

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions demo/src/main/webapp/js/ng-file-upload-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* progress, resize, thumbnail, preview, validation and CORS
* FileAPI Flash shim for old browsers not supporting FormData
* @author Danial <danial.farid@gmail.com>
* @version 9.1.0
* @version 9.1.1
*/

(function () {
Expand Down Expand Up @@ -294,7 +294,7 @@
}

if (FileAPI.staticPath == null) FileAPI.staticPath = basePath;
script.setAttribute('src', jsUrl || basePath + 'FileAPI.min.js');
script.setAttribute('src', jsUrl || basePath + 'FileAPI.js');
document.getElementsByTagName('head')[0].appendChild(script);
}

Expand Down Expand Up @@ -408,12 +408,6 @@ if (!window.FileReader) {
_this.dispatchEvent(e);
}
};
this.readAsArrayBuffer = function (file) {
FileAPI.readAsBinaryString(file, listener);
};
this.readAsBinaryString = function (file) {
FileAPI.readAsBinaryString(file, listener);
};
this.readAsDataURL = function (file) {
FileAPI.readAsDataURL(file, listener);
};
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/webapp/js/ng-file-upload-shim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions demo/src/main/webapp/js/ng-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
* progress, resize, thumbnail, preview, validation and CORS
* @author Danial <danial.farid@gmail.com>
* @version 9.1.0
* @version 9.1.1
*/

if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
Expand All @@ -23,7 +23,7 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {

var ngFileUpload = angular.module('ngFileUpload', []);

ngFileUpload.version = '9.1.0';
ngFileUpload.version = '9.1.1';

ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
var upload = this;
Expand Down Expand Up @@ -523,7 +523,7 @@ ngFileUpload.service('Upload', ['$parse', '$timeout', '$compile', '$q', 'UploadE
files = valids;
}
var fixOrientation = upload.emptyPromise(files);
if (upload.attrGetter('ngfFixOrientation', attr, scope) !== false) {
if (upload.attrGetter('ngfFixOrientation', attr, scope) !== false && upload.isExifSupported()) {
fixOrientation = applyExifRotations(files);
}
fixOrientation.then(function () {
Expand Down Expand Up @@ -1877,6 +1877,10 @@ ngFileUpload.service('UploadExif', ['UploadResize', '$q', function (UploadResize

}

upload.isExifSupported = function() {
return window.FileReader && new FileReader().readAsArrayBuffer && upload.isResizeSupported();
};

upload.orientation = function (file) {
if (file.$ngfOrientation != null) {
return upload.emptyPromise(file.$ngfOrientation);
Expand Down
4 changes: 2 additions & 2 deletions demo/src/main/webapp/js/ng-file-upload.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/FileAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@
}
}
else {
_emit(file, fn, 'error', undef, { error: 'filreader_not_support_'+as });
_emit(file, fn, 'error', undef, { error: 'FileReader_not_support_'+as });
}
}

Expand Down
Loading

0 comments on commit 633be83

Please sign in to comment.