public/js/jquery.filedrop.js
function() {

        var fileIndex;

        if (stop_loop) {
          return false;
        }

        // Check to see if are in queue mode
        if (opts.queuefiles > 0 && processingQueue.length >= opts.queuefiles) {
          return pause(opts.queuewait);
        } else {
          // Take first thing off work queue
          fileIndex = workQueue[0];
          workQueue.splice(0, 1);

          // Add to processing queue
          processingQueue.push(fileIndex);
        }

        try {
          if (beforeEach(files[fileIndex]) !== false) {
            if (fileIndex === files_count) {
              return;
            }
            var reader = new FileReader(),
                max_file_size = 1048576 * opts.maxfilesize;

            reader.index = fileIndex;
            if (files[fileIndex].size > max_file_size) {
              opts.error(errors[2], files[fileIndex], fileIndex);
              // Remove from queue
              processingQueue.forEach(function(value, key) {
                if (value === fileIndex) {
                  processingQueue.splice(key, 1);
                }
              });
              filesRejected++;
              return true;
            }

            reader.onloadend = !opts.beforeSend ? send : function (e) {
              opts.beforeSend(files[fileIndex], fileIndex, function () { send(e); });
            };

            reader.readAsBinaryString(files[fileIndex]);

          } else {
            filesRejected++;
          }
        } catch (err) {
          // Remove from queue
          processingQueue.forEach(function(value, key) {
            if (value === fileIndex) {
              processingQueue.splice(key, 1);
            }
          });
          opts.error(errors[0]);
          return false;
        }

        // If we still have work to do,
        if (workQueue.length > 0) {
          process();
        }
      }
function() {

        var fileIndex;

        if (stop_loop) {
          return false;
        }

        // Check to see if are in queue mode
        if (opts.queuefiles > 0 && processingQueue.length >= opts.queuefiles) {
          return pause(opts.queuewait);
        } else {
          // Take first thing off work queue
          fileIndex = workQueue[0];
          workQueue.splice(0, 1);

          // Add to processing queue
          processingQueue.push(fileIndex);
        }

        try {
          if (beforeEach(files[fileIndex]) !== false) {
            if (fileIndex === files_count) {
              return;
            }
            var reader = new FileReader(),
                max_file_size = 1048576 * opts.maxfilesize;

            reader.index = fileIndex;
            if (files[fileIndex].size > max_file_size) {
              opts.error(errors[2], files[fileIndex], fileIndex);
              // Remove from queue
              processingQueue.forEach(function(value, key) {
                if (value === fileIndex) {
                  processingQueue.splice(key, 1);
                }
              });
              filesRejected++;
              return true;
            }

            reader.onloadend = !opts.beforeSend ? send : function (e) {
              opts.beforeSend(files[fileIndex], fileIndex, function () { send(e); });
            };

            reader.readAsBinaryString(files[fileIndex]);

          } else {
            filesRejected++;
          }
        } catch (err) {
          // Remove from queue
          processingQueue.forEach(function(value, key) {
            if (value === fileIndex) {
              processingQueue.splice(key, 1);
            }
          });
          opts.error(errors[0]);
          return false;
        }

        // If we still have work to do,
        if (workQueue.length > 0) {
          process();
        }
      }
function ( ) { var fileIndex ; if ( stop_loop ) { return false ; } // Check to see if are in queue mode if ( opts . queuefiles > 0 && processingQueue . length >= opts . queuefiles ) { return pause ( opts . queuewait ) ; } else { // Take first thing off work queue fileIndex = workQueue [ 0 ] ; workQueue . splice ( 0 , 1 ) ; // Add to processing queue processingQueue . push ( fileIndex ) ; } try { if ( beforeEach ( files [ fileIndex ] ) !== false ) { if ( fileIndex === files_count ) { return ; } var reader = new FileReader ( ) , max_file_size = 1048576 * opts . maxfilesize ; reader . index = fileIndex ; if ( files [ fileIndex ] . size > max_file_size ) { opts . error ( errors [ 2 ] , files [ fileIndex ] , fileIndex ) ; // Remove from queue processingQueue . forEach ( function ( value , key ) { if ( value === fileIndex ) { processingQueue . splice ( key , 1 ) ; } } ) ; filesRejected ++ ; return true ; } reader . onloadend = ! opts . beforeSend ? send : function ( e ) { opts . beforeSend ( files [ fileIndex ] , fileIndex , function ( ) { send ( e ) ; } ) ; } ; reader . readAsBinaryString ( files [ fileIndex ] ) ; } else { filesRejected ++ ; } } catch ( err ) { // Remove from queue processingQueue . forEach ( function ( value , key ) { if ( value === fileIndex ) { processingQueue . splice ( key , 1 ) ; } } ) ; opts . error ( errors [ 0 ] ) ; return false ; } // If we still have work to do, if ( workQueue . length > 0 ) { process ( ) ; } }
Process an upload, recursive
Process an upload recursive