Callback for global upload progress events:
173843
function (e, data) {
                var $this = $(this),
                    progress = Math.floor(data.loaded / data.total * 100),
                    globalProgressNode = $this.find('.fileupload-progress'),
                    extendedProgressNode = globalProgressNode
                        .find('.progress-extended');
                if (extendedProgressNode.length) {
                    extendedProgressNode.html(
                        ($this.data('blueimp-fileupload') || $this.data('fileupload'))
                            ._renderExtendedProgress(data)
                    );
                }
                globalProgressNode
                    .find('.progress')
                    .attr('aria-valuenow', progress)
                    .find('.bar').css(
                        'width',
                        progress + '%'
                    );
            }
476143
function upload (options, callback) {
  const promise = (
    Promise.resolve(options)
      .then(applyDefaults)
      .then(validateOptions)
      .then(opts => {
        options = opts
        return options
      })
      .then(transformOptions)
      .then(prepareRequest)
      .then(sendRequest)
      .catch(err => {
        return cleanupTempFiles(options)
          .then(() => Promise.reject(err))
      })
      .then(cleanupTempFiles)
  )
  if (callback) {
    promise
      .then(message => callback(null, message))
      .catch(err => callback(err, null))
  }
  return promise
}
232294
@Override
    public void onProgress(final StreamingProgressEvent event) {
        assertStateConsistency(fileUploadId, event.getFileName());

        if (event.getBytesReceived() > maxSize || event.getContentLength() > maxSize) {
            LOG.error("User tried to upload more than was allowed ({}).", maxSize);
            interruptUploadDueToFileSizeExceeded(maxSize);
            return;
        }
        if (isUploadInterrupted()) {
            return;
        }

        publishUploadProgressEvent(fileUploadId, event.getBytesReceived(), event.getContentLength());
    }
65324
function upload() {
      stop_loop = false;

      if (!files) {
        opts.error(errors[0]);
        return false;
      }

      if (opts.allowedfiletypes.push && opts.allowedfiletypes.length) {
        for(var fileIndex = files.length;fileIndex--;) {
          if(!files[fileIndex].type || $.inArray(files[fileIndex].type, opts.allowedfiletypes) < 0) {
            opts.error(errors[3], files[fileIndex]);
            return false;
          }
        }
      }

      var filesDone = 0,
          filesRejected = 0;

      if (files_count > opts.maxfiles && opts.queuefiles === 0) {
        opts.error(errors[1]);
        return false;
      }

      // Define queues to manage upload process
      var workQueue = [];
      var processingQueue = [];
      var doneQueue = [];

      // Add everything to the workQueue
      for (var i = 0; i < files_count; i++) {
        workQueue.push(i);
      }

      // Helper function to enable pause of processing to wait
      // for in process queue to complete
      var pause = function(timeout) {
        setTimeout(process, timeout);
        return;
      };

      // Process an upload, recursive
      var 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();
        }
      };

      var send = function(e) {

        var fileIndex = ((typeof(e.srcElement) === "undefined") ? e.target : e.srcElement).index;

        // Sometimes the index is not attached to the
        // event object. Find it by size. Hack for sure.
        if (e.target.index === undefined) {
          e.target.index = getIndexBySize(e.total);
        }

        var xhr = new XMLHttpRequest(),
            upload = xhr.upload,
            file = files[e.target.index],
            index = e.target.index,
            start_time = new Date().getTime(),
            boundary = '------multipartformboundary' + (new Date()).getTime(),
            global_progress_index = global_progress.length,
            builder,
            newName = rename(file.name),
            mime = file.type;

        if (typeof newName === "string") {
          builder = getBuilder(newName, e.target.result, mime, boundary);
        } else {
          builder = getBuilder(file.name, e.target.result, mime, boundary);
        }

        upload.index = index;
        upload.file = file;
        upload.downloadStartTime = start_time;
        upload.currentStart = start_time;
        upload.currentProgress = 0;
        upload.global_progress_index = global_progress_index;
        upload.startData = 0;
        upload.addEventListener("progress", progress, false);

        xhr.open("POST", opts.url, true);
        xhr.setRequestHeader('content-type', 'multipart/form-data; boundary=' + boundary);

        // Add headers
        $.each(opts.headers, function(k, v) {
          xhr.setRequestHeader(k, v);
        });

        xhr.sendAsBinary(builder);

        global_progress[global_progress_index] = 0;
        globalProgress();

        opts.uploadStarted(index, file, files_count);

        xhr.onload = function() {
            var serverResponse = null;

            if (xhr.responseText) {
              try {
                serverResponse = jQuery.parseJSON(xhr.responseText);
              }
              catch (e) {
                serverResponse = xhr.responseText;
              }
            }

            var now = new Date().getTime(),
                timeDiff = now - start_time,
                result = opts.uploadFinished(index, file, serverResponse, timeDiff, xhr);
            filesDone++;

            // Remove from processing queue
            processingQueue.forEach(function(value, key) {
              if (value === fileIndex) {
                processingQueue.splice(key, 1);
              }
            });

            // Add to donequeue
            doneQueue.push(fileIndex);

            // Make sure the global progress is updated
            global_progress[global_progress_index] = 100;
            globalProgress();

            if (filesDone === (files_count - filesRejected)) {
              afterAll();
            }
            if (result === false) {
              stop_loop = true;
            }
          

          // Pass any errors to the error option
          if (xhr.status < 200 && xhr.status > 299) {
            opts.error(xhr.statusText);
          }
        };
      };

      // Initiate the processing loop
      process();
    }
270765
function multipartEncoded(gw, callback){
  var upload = new formidable.IncomingForm();
  var files = {};
  var fields = {};    

  gw.eventium.on('end',cleanTemp);

  upload.uploadDir = tempDirectory;
  upload.keepExtensions = true;
  upload.onPart = function(part) {
    if (part.filename!="") {
      upload.handlePart(part);
    }
  }
  upload
    .on('progress', function(bytesReceived, bytesExpected) {
      var percent_complete = (bytesReceived / bytesExpected) * 100;
    })
    .on('error', function (error) {gw.error(500,error);})
    .on('field', function (field, value) {
      if (fields[field]) {
        if (!Array.isArray(fields[field])) {fields[field]=[fields[field]];}
        fields[field].push(value);
      } else {
        fields[field]=value;
      }
    })
    .on('file', function(field, file) {
      file.ext =  file.name.replace(/^.*\./,'');
      if (fields[field]) {
        if(!Array.isArray(fields[field])){fields[field]=[fields[field]];}
        fields[field].push(file);
      } else {
        fields[field]=file;
      }
      if (files[field]) {
        if (!Array.isArray(files[field])) {files[field]=[files[field]];}
        files[field].push(file);
      } else {
        files[field]=file;
      }
    })
    .on('end', function() {
      fields = gw.constructor.queryHeap(fields);
      gw.content.params = fields;
      for(var i=0,k=Object.keys(fields),l=k.length;i<l;i++){
        gw.params[k[i]]=fields[k[i]];
      }
      gw.files = files;
      callback();
    })
  ;
  upload.parse(gw.req);
}
655286
function (req, res) {
                var s3 = new AWS.S3(),
                    bucket = req.params.name,
                    key = getFullKeyParam(req.params, req.route),
                    contentType = mime.lookup(key),
                    params = {
                        Bucket: bucket,
                        Key: key,
                        // Pipe the file through the request body
                        Body: req
                    },
                    trackUploadProgress = function (evt) {
                        // This function is called each time a chunk of the file is uploaded
                        //console.log(evt);
                    },
                    handleUploadComplete = function (err, data) {
                        if (err) {
                            res.status(500).send(err);
                        } else {
                            // Add s3g link to reference the resource                            
                            data.links = [{
                                rel: 'self',
                                href: getOriginalink(req)
                            }];
                            
                            res.json(data);
                        }
                    };

				// Set content type for object if we have one
                if (contentType) {
                    params.ContentType = contentType;
                }

                s3.upload(params).on('httpUploadProgress', trackUploadProgress).send(handleUploadComplete);
            }
805955
protected void updateProgress() {

        CmsRpcAction<CmsUploadProgessInfo> callback = new CmsRpcAction<CmsUploadProgessInfo>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                getUploadService().getUploadProgressInfo(this);
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onFailure(java.lang.Throwable)
             */
            @Override
            public void onFailure(Throwable t) {

                super.onFailure(t);
                cancelUpdateProgress();
            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(CmsUploadProgessInfo result) {

                updateProgressBar(result);
            }
        };
        callback.execute();
    }
1243229
function onUpdateAllCompleted(userComments, callback, polledData) {
    var logDump = createLogDump(
        userComments, Constants,
        EventsTracker.getInstance().getAllCapturedEvents(), polledData,
        getTabData_(), timeutil.getCurrentTime());
    callback(JSON.stringify(logDump));
  }
1307166
public function upload_progress()
    {
        $params = array(
            'action' => $this->action,
            'name'   => rcube_utils::get_input_value('_progress', rcube_utils::INPUT_GET),
        );

        if (function_exists('uploadprogress_get_info')) {
            $status = uploadprogress_get_info($params['name']);

            if (!empty($status)) {
                $params['current'] = $status['bytes_uploaded'];
                $params['total']   = $status['bytes_total'];
            }
        }

        if (!isset($status) && filter_var(ini_get('apc.rfc1867'), FILTER_VALIDATE_BOOLEAN)
            && ini_get('apc.rfc1867_name')
        ) {
            $prefix = ini_get('apc.rfc1867_prefix');
            $status = apc_fetch($prefix . $params['name']);

            if (!empty($status)) {
                $params['current'] = $status['current'];
                $params['total']   = $status['total'];
            }
        }

        if (!isset($status) && filter_var(ini_get('session.upload_progress.enabled'), FILTER_VALIDATE_BOOLEAN)
            && ini_get('session.upload_progress.name')
        ) {
            $key = ini_get('session.upload_progress.prefix') . $params['name'];

            $params['total']   = $_SESSION[$key]['content_length'];
            $params['current'] = $_SESSION[$key]['bytes_processed'];
        }

        if (!empty($params['total'])) {
            $total = $this->show_bytes($params['total'], $unit);
            switch ($unit) {
            case 'GB':
                $gb      = $params['current']/1073741824;
                $current = sprintf($gb >= 10 ? "%d" : "%.1f", $gb);
                break;
            case 'MB':
                $mb      = $params['current']/1048576;
                $current = sprintf($mb >= 10 ? "%d" : "%.1f", $mb);
                break;
            case 'KB':
                $current = round($params['current']/1024);
                break;
            case 'B':
            default:
                $current = $params['current'];
                break;
            }

            $params['percent'] = round($params['current']/$params['total']*100);
            $params['text']    = $this->gettext(array(
                'name' => 'uploadprogress',
                'vars' => array(
                    'percent' => $params['percent'] . '%',
                    'current' => $current,
                    'total'   => $total
                )
            ));
        }

        $this->output->command('upload_progress_update', $params);
        $this->output->send();
    }
1189186
function uploadHandler (event) {
    const target = event.target;

    if (target.files && target.files[0]) {
      file = target.files[0];
      const reader = new FileReader();

      reader.addEventListener('load', loadHandler);

      reader.readAsDataURL(file);
    }
  }
1197297
function(threadId, callback) {
                var uploadQ = [];
                for (var i = 0; i < chatUploadQueue.length; i++) {
                    if (chatUploadQueue[i].threadId == threadId) {
                        uploadQ.push(chatUploadQueue[i]);
                    }
                }

                callback && callback(chatUploadQueue);
            }
731529
function(){
			var deferred = new Deferred();
			this.progressService.progress(deferred, messages.ReloadingAllPlugins);
			deferred.progress({type: "progress"});
			var plugins = this.settings.pluginRegistry.getPlugins();
			var updates = [];
			plugins.forEach(function(plugin){
				updates.push(plugin.update());
			});
			Deferred.all(updates, function(){}).then(function() {
				this.reloaded();
				deferred.resolve();
			}.bind(this), deferred.reject, deferred.progress);
		}
901052
function (e) {
			var $progress = $('.progress:first', this.$el),
					complete;

			if (e.lengthComputable) {
				complete = e.loaded / e.total * 100;
				complete = complete ? complete : 0;
				$progress.attr('value', complete);
				$progress.html(complete);
			}
		}
868799
def finish_upload_and_wait(self, component, length,
                               timeout=2, interval=0.1):
        
        try:
            rsp = self.finish_firmware_upload(component, length)
            check_completion_code(rsp.completion_code)
        except CompletionCodeError as e:
            if e.cc == CC_LONG_DURATION_CMD_IN_PROGRESS:
                self.wait_for_long_duration_command(
                            constants.CMDID_HPM_FINISH_FIRMWARE_UPLOAD,
                            timeout, interval)
            else:
                raise HpmError('finish_firmware_upload CC=0x%02x' % e.cc)
1193945
def notify_progress(self):
        '''  '''
        _total = 0
        for _session in self._sessions.values():
            _total += _session.bytes_transferred

        if AsperaSession.PROGRESS_MSGS_SEND_ALL:
            self._run_progress_callbacks(_total)
        else:
            # dont call progress callback unless total has changed
            if self._total_bytes_transferred != _total:
                self._total_bytes_transferred = _total
                self._run_progress_callbacks(_total)
1115679
private void onUploadFinished() {
        if (artifactUploadState.areAllUploadsFinished() && artifactUploadState.isStatusPopupMinimized()) {
            if (artifactUploadState.getFilesInFailedState().isEmpty()) {
                cleanupStates();
                closeWindow();
            } else {
                maximizeWindow();
            }
        }
    }
1012612
function (files) {
        for (var i = 0; i < files.length; i++) {
          let f = files[i]
          console.log(' meeting: Filename: ' + f.name + ', type: ' + (f.type || 'n/a') +
            ' size: ' + f.size + ' bytes, last modified: ' +
            (f.lastModifiedDate ? f.lastModifiedDate.toLocaleDateString() : 'n/a')
          ) // See e.g. https://www.html5rocks.com/en/tutorials/file/dndfiles/

          // @@ Add: progress bar(s)
          var reader = new FileReader()
          reader.onload = (function (theFile) {
            return function (e) {
              var data = e.target.result
              console.log(' File read byteLength : ' + data.byteLength)
              var filename = encodeURIComponent(theFile.name)
              var contentType = theFile.type
              uploadFileToContact(filename, contentType, data)
            }
          })(f)
          reader.readAsArrayBuffer(f)
        }
      }