File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 442442 } ) ;
443443 return uploading ;
444444 } ,
445+
446+ uploadingNum : function ( ) {
447+ var num = 0 ;
448+ each ( this . files , function ( file ) {
449+ if ( file . isUploading ( ) ) {
450+ num ++ ;
451+ }
452+ } ) ;
453+ return num ;
454+ } ,
445455
446456 /**
447457 * Start or resume uploading.
448458 * @function
449459 */
450460 upload : function ( ) {
451461 // Make sure we don't start too many uploads at once
452- if ( this . isUploading ( ) ) {
462+ var uploadingNum = this . uploadingNum ( ) ;
463+ if ( uploadingNum >= this . opts . simultaneousUploads ) {
453464 return ;
454465 }
455466 // Kick off the queue
456467 this . fire ( 'uploadStart' ) ;
457468 var started = false ;
458- for ( var num = 1 ; num <= this . opts . simultaneousUploads ; num ++ ) {
469+ for ( var num = 1 ; num <= this . opts . simultaneousUploads - uploadingNum ; num ++ ) {
459470 started = this . uploadNextChunk ( true ) || started ;
460471 }
461472 if ( ! started ) {
You can’t perform that action at this time.
0 commit comments