Here is the HTML code I'm using:
<input type="file" nv-file-select="" options="{ photoType: 'studentPic' }" uploader="uploader" />
This is my AngularJS code:
var uploader = $scope.uploader = new FileUploader({
url: 'badges/photos',
autoUpload: true
});
// FILTERS
uploader.filters.push({
name: 'customFilter',
fn: function (item /*{File|FileLikeObject}*/ , options) {
return this.queue.length < 10;
}
});
// CALLBACKS
uploader.onWhenAddingFileFailed = function (item /*{File|FileLikeObject}*/ , filter, options) {
console.info('onWhenAddingFileFailed', item, filter, options);
};
// More callback functions go here...
In my uploader.onBeforeUploadItem function, I have a condition that checks if the file type is not "image/png" or "image/jpeg", or the size is greater than 102400. If this condition is met, I call the cancelItem method. However, despite meeting these conditions, the upload of the item still goes through successfully. Am I calling the cancelItem method incorrectly? Any help would be appreciated.