Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #27 from iFixit/add-file-failure-mode-option

Add abortOnFailure option
  • Loading branch information...
commit 22f1119fffac40fb2cf501fc7c13a3941962ae9d 2 parents 9d160b6 + 3cd2b12
@Thinkscape Thinkscape authored
Showing with 10 additions and 5 deletions.
  1. +9 −5 client/fileuploader.js
  2. +1 −0  readme.md
View
14 client/fileuploader.js
@@ -280,6 +280,7 @@ qq.FileUploaderBasic = function(o){
acceptFiles: null, // comma separated string of mime-types for browser to display in browse dialog
sizeLimit: 0,
minSizeLimit: 0,
+ abortOnFailure: true, // Fail all files if one doesn't meet the criteria
// events
// return false to cancel submit
onSubmit: function(id, fileName){},
@@ -417,14 +418,17 @@ qq.FileUploaderBasic.prototype = {
this._button.reset();
},
_uploadFileList: function(files){
+ var goodFiles = [];
for (var i=0; i<files.length; i++){
- if ( !this._validateFile(files[i])){
- return;
- }
+ if (this._validateFile(files[i])){
+ goodFiles.push(files[i]);
+ } else {
+ if (this._options.abortOnFailure) return;
+ }
}
- for (var i=0; i<files.length; i++){
- this._uploadFile(files[i]);
+ for (var i=0; i<goodFiles.length; i++){
+ this._uploadFile(goodFiles[i]);
}
},
_uploadFile: function(fileContainer){
View
1  readme.md
@@ -96,6 +96,7 @@ var uploader = new qq.FileUploader({
// this option isn't supported in all browsers
sizeLimit: 0, // max size
minSizeLimit: 0, // min size
+ abortOnFailure: true, // Fail all files if one doesn't meet the criteria
// set to true to output server response to console
debug: false,
Please sign in to comment.
Something went wrong with that request. Please try again.