Skip to content

Commit 740b610

Browse files
Danial FaridDanial Farid
Danial Farid
authored and
Danial Farid
committed
merged PRs and updated readme
2 parents 7758b69 + ac9d92a commit 740b610

19 files changed

+44
-40
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Table of Content:
3737
* image resize and center crop (native) and user controlled crop through [ngImgCrop](https://github.com/alexk111/ngImgCrop). See [crop sample](http://jsfiddle.net/xxo3sk41/1/) (html5 only)
3838
* orientation fix for jpeg image files with exif orientation data
3939
* resumable uploads: pause/resume upload (html5 only)
40-
* native validation support for file type/size, image width/height/aspect ratio, video/audio duration, and `ng-required` with pluggable cusome sync or async validations.
40+
* native validation support for file type/size, image width/height/aspect ratio, video/audio duration, and `ng-required` with pluggable custom sync or async validations.
4141
* show thumbnail or preview of selected images/audio/videos
4242
* supports CORS and direct upload of file's binary data using `Upload.$http()`
4343
* plenty of sample server side code, available on nuget
@@ -112,7 +112,7 @@ var app = angular.module('fileUpload', ['ngFileUpload']);
112112
app.controller('MyCtrl', ['$scope', 'Upload', function ($scope, Upload) {
113113
// upload later on form submit or something similar
114114
$scope.submit = function() {
115-
if (form.file.$valid && $scope.file) {
115+
if ($scope.form.file.$valid && $scope.file) {
116116
$scope.upload($scope.file);
117117
}
118118
};
@@ -166,6 +166,8 @@ At least one of the `ngf-select` or `ngf-drop` are mandatory for the plugin to l
166166
// allowInvalid default is false could allow invalid files in the model
167167
// debouncing will postpone model update (miliseconds). See angular ng-model-options for more details.
168168
ngf-model-invalid="invalidFile(s)" // binds the invalid selected/dropped file or files to this model.
169+
ngf-before-model-change="beforeChange($files, ...)" // called after file select/drop and before
170+
// model change, validation and resize is processed
169171
ng-disabled="boolean" // disables this element
170172
ngf-select-disabled="boolean" // default false, disables file select on this element
171173
ngf-drop-disabled="boolean" // default false, disables file drop on this element
@@ -378,14 +380,16 @@ for jsob byte streaming support #359 */
378380
Upload.jsonBlob(obj)
379381
/* converts the value to json to send data as json string. Same as angular.toJson(obj) */
380382
Upload.json(obj)
381-
/* converts a dataUrl to Blob object.
383+
/* converts a dataUrl to Blob object.*/
382384
var blob = upload.dataUrltoBlob(dataurl, name);
383385
/* returns true if there is an upload in progress. Can be used to prompt user before closing browser tab */
384386
Upload.isUploadInProgress() boolean
385387
/* downloads and converts a given url to Blob object which could be added to files model */
386388
Upload.urlToBlob(url).then(function(blob) {...});
387389
/* returns boolean to check if the object is file and could be used as file in Upload.upload()/http() */
388390
Upload.isFile(obj);
391+
/* fixes the exif orientation of the jpeg image file*/
392+
Upload.applyExifRotation(file).then(...)
389393
```
390394
**ng-model**
391395
The model value will be a single file instead of an array if all of the followings are true:
@@ -495,7 +499,7 @@ provided by [Coshx Labs](http://www.coshx.com/).
495499
* Sample client and server code [demo/C#] (https://github.com/danialfarid/ng-file-upload/tree/master/demo/C%23) provided by [AtomStar](https://github.com/AtomStar)
496500

497501
##<a name="cors"></a>CORS
498-
To support CORS upload your server needs to allow cross domain requests. You can achive that by having a filter or interceptor on your upload file server to add CORS headers to the response similar to this:
502+
To support CORS upload your server needs to allow cross domain requests. You can achieve that by having a filter or interceptor on your upload file server to add CORS headers to the response similar to this:
499503
([sample java code](https://github.com/danialfarid/ng-file-upload/blob/master/demo/src/main/java/com/df/angularfileupload/CORSFilter.java))
500504
```java
501505
httpResp.setHeader("Access-Control-Allow-Methods", "POST, PUT, OPTIONS");

demo/src/main/webapp/js/FileAPI.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.

demo/src/main/webapp/js/ng-file-upload-all.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* progress, resize, thumbnail, preview, validation and CORS
44
* FileAPI Flash shim for old browsers not supporting FormData
55
* @author Danial <[email protected]>
6-
* @version 12.0.0
6+
* @version 12.0.1
77
*/
88

99
(function () {
@@ -424,7 +424,7 @@ if (!window.FileReader) {
424424
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
425425
* progress, resize, thumbnail, preview, validation and CORS
426426
* @author Danial <[email protected]>
427-
* @version 12.0.0
427+
* @version 12.0.1
428428
*/
429429

430430
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
@@ -445,14 +445,14 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
445445

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

448-
ngFileUpload.version = '12.0.0';
448+
ngFileUpload.version = '12.0.1';
449449

450450
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
451451
var upload = this;
452452
upload.promisesCount = 0;
453453

454454
this.isResumeSupported = function () {
455-
return window.Blob && (window.Blob instanceof Function) && new window.Blob().slice;
455+
return window.Blob && (window.Blob instanceof Function) && window.Blob.prototype.slice;
456456
};
457457

458458
var resumeSupported = this.isResumeSupported();
@@ -1199,7 +1199,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
11991199
try {
12001200
if (!isInputTypeFile() && !document.body.contains(fileElem[0])) {
12011201
generatedElems.push({el: elem, ref: fileElem.parent()});
1202-
document.body.appendChild(fileElem[0].parent());
1202+
document.body.appendChild(fileElem.parent()[0]);
12031203
fileElem.bind('change', changeFn);
12041204
}
12051205
} catch(e){/*ignore*/}

demo/src/main/webapp/js/ng-file-upload-all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/main/webapp/js/ng-file-upload-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* progress, resize, thumbnail, preview, validation and CORS
44
* FileAPI Flash shim for old browsers not supporting FormData
55
* @author Danial <[email protected]>
6-
* @version 12.0.0
6+
* @version 12.0.1
77
*/
88

99
(function () {

demo/src/main/webapp/js/ng-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.

demo/src/main/webapp/js/ng-file-upload.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
33
* progress, resize, thumbnail, preview, validation and CORS
44
* @author Danial <[email protected]>
5-
* @version 12.0.0
5+
* @version 12.0.1
66
*/
77

88
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
@@ -23,14 +23,14 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
2323

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

26-
ngFileUpload.version = '12.0.0';
26+
ngFileUpload.version = '12.0.1';
2727

2828
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
2929
var upload = this;
3030
upload.promisesCount = 0;
3131

3232
this.isResumeSupported = function () {
33-
return window.Blob && (window.Blob instanceof Function) && new window.Blob().slice;
33+
return window.Blob && (window.Blob instanceof Function) && window.Blob.prototype.slice;
3434
};
3535

3636
var resumeSupported = this.isResumeSupported();
@@ -777,7 +777,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
777777
try {
778778
if (!isInputTypeFile() && !document.body.contains(fileElem[0])) {
779779
generatedElems.push({el: elem, ref: fileElem.parent()});
780-
document.body.appendChild(fileElem[0].parent());
780+
document.body.appendChild(fileElem.parent()[0]);
781781
fileElem.bind('change', changeFn);
782782
}
783783
} catch(e){/*ignore*/}

demo/src/main/webapp/js/ng-file-upload.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/FileAPI.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/ng-file-upload-all.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* progress, resize, thumbnail, preview, validation and CORS
44
* FileAPI Flash shim for old browsers not supporting FormData
55
* @author Danial <[email protected]>
6-
* @version 12.0.0
6+
* @version 12.0.1
77
*/
88

99
(function () {
@@ -424,7 +424,7 @@ if (!window.FileReader) {
424424
* AngularJS file upload directives and services. Supoorts: file upload/drop/paste, resume, cancel/abort,
425425
* progress, resize, thumbnail, preview, validation and CORS
426426
* @author Danial <[email protected]>
427-
* @version 12.0.0
427+
* @version 12.0.1
428428
*/
429429

430430
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
@@ -445,14 +445,14 @@ if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
445445

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

448-
ngFileUpload.version = '12.0.0';
448+
ngFileUpload.version = '12.0.1';
449449

450450
ngFileUpload.service('UploadBase', ['$http', '$q', '$timeout', function ($http, $q, $timeout) {
451451
var upload = this;
452452
upload.promisesCount = 0;
453453

454454
this.isResumeSupported = function () {
455-
return window.Blob && (window.Blob instanceof Function) && new window.Blob().slice;
455+
return window.Blob && (window.Blob instanceof Function) && window.Blob.prototype.slice;
456456
};
457457

458458
var resumeSupported = this.isResumeSupported();
@@ -1199,7 +1199,7 @@ ngFileUpload.directive('ngfSelect', ['$parse', '$timeout', '$compile', 'Upload',
11991199
try {
12001200
if (!isInputTypeFile() && !document.body.contains(fileElem[0])) {
12011201
generatedElems.push({el: elem, ref: fileElem.parent()});
1202-
document.body.appendChild(fileElem[0].parent());
1202+
document.body.appendChild(fileElem.parent()[0]);
12031203
fileElem.bind('change', changeFn);
12041204
}
12051205
} catch(e){/*ignore*/}

dist/ng-file-upload-all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ng-file-upload-shim.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* progress, resize, thumbnail, preview, validation and CORS
44
* FileAPI Flash shim for old browsers not supporting FormData
55
* @author Danial <[email protected]>
6-
* @version 12.0.0
6+
* @version 12.0.1
77
*/
88

99
(function () {

0 commit comments

Comments
 (0)