jquery.fileupload.js

About this file

Refer to jQuery's file upload plugin. See extracted documentation for GitHub link.

Code Check Report




    15:1   error    Unnecessary semicolon                                    no-extra-semi
    26:13  error    Unexpected require()                                     global-require
    27:13  error    Unexpected require()                                     global-require
    33:3   warning  Function has a complexity of 7                           complexity
   372:22  warning  Method '_onProgress' has a complexity of 9               complexity
   442:23  warning  Method '_initXHRData' has a complexity of 15             complexity
   571:28  warning  Method '_initFormSettings' has a complexity of 13        complexity
   721:25  warning  Method '_chunkedUpload' has a complexity of 10           complexity
   971:17  warning  Method '_onAdd' has a complexity of 22                   complexity
  1000:26  error    'i' is already defined                                   no-redeclare
  1011:26  error    'i' is already defined                                   no-redeclare
  1175:35  warning  Method '_getSingleFileInputFiles' has a complexity of 8  complexity
  1428:15  warning  Method 'send' has a complexity of 7                      complexity

✖ 13 problems (5 errors, 8 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.
                        

Documentation drawn from source code

/*
* jQuery File Upload Plugin
*
* Copyright 2010, Sebastian Tschan
*
* Licensed under the MIT license:
*/
/* jshint nomen:false */
/* global define, require, window, document, location, Blob, FormData */
;(function (factory) {
  if (typeof define === 'function' && define.amd) {
}(function ($) {
  function getDragHandler(type) {
   return function (e) {
    i18n: function (message, context) {
      $.each(context, function (key, value) {
    formData: function (form) {
    add: function (e, data) {
      data.process().done(function () {
   _blobSlice: $.support.blobSlice && function () {
   _BitrateTimer: function () {
    this.getBitrate = function (now, loaded, interval) {
   _isXHRUpload: function (options) {
   _getFormData: function (options) {
    if ($.type(options.formData) === 'function') {
     $.each(options.formData, function (name, value) {
   _getTotal: function (files) {
    $.each(files, function (index, file) {
   _initProgressObject: function (obj) {
   _initResponseObject: function (obj) {
   _onProgress: function (e, data) {
   _initProgressListener: function (options) {
     $(xhr.upload).bind('progress', function (e) {
     options.xhr = function () {
   _isInstanceOf: function (type, obj) {
   _initXHRData: function (options) {
       $.each(options.files, function (index, file) {
       $.each(this._getFormData(options), function (index, field) {
       $.each(options.files, function (index, file) {
   _initIframeSettings: function (options) {
   _initDataSettings: function (options) {
   _getParamName: function (options) {
     fileInput.each(function () {
   _initFormSettings: function (options) {
   _getAJAXSettings: function (data) {
   _getDeferredState: function (deferred) {
   _enhancePromise: function (promise) {
   _getXHRPromise: function (resolveOrReject, context, args) {
   _addConvenienceMethods: function (e, data) {
     getPromise = function (args) {
    data.process = function (resolveFunc, rejectFunc) {
        function () {
    data.submit = function () {
    data.abort = function () {
    data.state = function () {
    data.processing = function () {
    data.progress = function () {
    data.response = function () {
   _getUploadedBytes: function (jqXHR) {
   _chunkedUpload: function (options, testOnly) {
    upload = function () {
      .done(function (result, textStatus, jqXHR) {
      .fail(function (jqXHR, textStatus, errorThrown) {
    promise.abort = function () {
   _beforeSend: function (e, data) {
   _onDone: function (result, textStatus, jqXHR, options) {
   _onFail: function (jqXHR, textStatus, errorThrown, options) {
   _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
   _onSend: function (e, data) {
     send = function () {
      ).done(function (result, textStatus, jqXHR) {
      }).fail(function (jqXHR, textStatus, errorThrown) {
      }).always(function (jqXHRorResult, textStatus, jqXHRorError) {
     pipe.abort = function () {
   _onAdd: function (e, data) {
    $.each(fileSet || files, function (index, element) {
   _replaceFileInput: function (data) {
    this.options.fileInput = this.options.fileInput.map(function (i, el) {
   _handleFileTreeEntry: function (entry, path) {
     errorHandler = function (e) {
     successHandler = function (entries) {
      ).done(function (files) {
     readEntries = function () {
      dirReader.readEntries(function (results) {
      entry.file(function (file) {
   _handleFileTreeEntries: function (entries, path) {
     $.map(entries, function (entry) {
    ).then(function () {
   _getDroppedFiles: function (dataTransfer) {
      $.map(items, function (item) {
   _getSingleFileInputFiles: function (fileInput) {
     $.each(files, function (index, file) {
   _getFileInputFiles: function (fileInput) {
    ).then(function () {
   _onChange: function (e) {
    this._getFileInputFiles(data.fileInput).always(function (files) {
   _onPaste: function (e) {
     $.each(items, function (index, item) {
   _onDrop: function (e) {
     this._getDroppedFiles(dataTransfer).always(function (files) {
   _initEventHandlers: function () {
   _destroyEventHandlers: function () {
   _setOption: function (key, value) {
   _initSpecialOptions: function () {
   _getRegExp: function (str) {
   _isRegExpOption: function (key, value) {
   _initDataAttributes: function () {
     function (index, attr) {
       key = key.slice(5).replace(/-[a-z]/g, function (str) {
   _create: function () {
   active: function () {
   progress: function () {
   add: function (data) {
     this._getFileInputFiles(data.fileInput).always(function (files) {
   send: function (data) {
      promise.abort = function () {
       function (files) {
         function (result, textStatus, jqXHR) {
         function (jqXHR, textStatus, errorThrown) {

Source code