function (e, data) {
                if (e.isDefaultPrevented()) {
                    return false;
                }
                var $this = $(this),
                    that = $this.data('blueimp-fileupload') ||
                        $this.data('fileupload'),
                    options = that.options;
                data.context = that._renderUpload(data.files)
                    .data('data', data)
                    .addClass('processing');
                options.filesContainer[
                    options.prependFiles ? 'prepend' : 'append'
                ](data.context);
                that._forceReflow(data.context);
                that._transition(data.context);
                data.process(function () {
                    return $this.fileupload('process', data);
                }).always(function () {
                    data.context.each(function (index) {
                        $(this).find('.size').text(
                            that._formatFileSize(data.files[index].size)
                        );
                    }).removeClass('processing');
                    that._renderPreviews(data);
                }).done(function () {
                    data.context.find('.start').prop('disabled', false);
                    if ((that._trigger('added', e, data) !== false) &&
                            (options.autoUpload || data.autoUpload) &&
                            data.autoUpload !== false) {
                        data.submit();
                    }
                }).fail(function () {
                    if (data.files.error) {
                        data.context.each(function (index) {
                            var error = data.files[index].error;
                            if (error) {
                                $(this).find('.error').text(error);
                            }
                        });
                    }
                });
            }
function (e, data) {
                if (e.isDefaultPrevented()) {
                    return false;
                }
                var $this = $(this),
                    that = $this.data('blueimp-fileupload') ||
                        $this.data('fileupload'),
                    options = that.options;
                data.context = that._renderUpload(data.files)
                    .data('data', data)
                    .addClass('processing');
                options.filesContainer[
                    options.prependFiles ? 'prepend' : 'append'
                ](data.context);
                that._forceReflow(data.context);
                that._transition(data.context);
                data.process(function () {
                    return $this.fileupload('process', data);
                }).always(function () {
                    data.context.each(function (index) {
                        $(this).find('.size').text(
                            that._formatFileSize(data.files[index].size)
                        );
                    }).removeClass('processing');
                    that._renderPreviews(data);
                }).done(function () {
                    data.context.find('.start').prop('disabled', false);
                    if ((that._trigger('added', e, data) !== false) &&
                            (options.autoUpload || data.autoUpload) &&
                            data.autoUpload !== false) {
                        data.submit();
                    }
                }).fail(function () {
                    if (data.files.error) {
                        data.context.each(function (index) {
                            var error = data.files[index].error;
                            if (error) {
                                $(this).find('.error').text(error);
                            }
                        });
                    }
                });
            }
function ( e , data ) { if ( e . isDefaultPrevented ( ) ) { return false ; } var $this = $ ( this ) , that = $this . data ( 'blueimp-fileupload' ) || $this . data ( 'fileupload' ) , options = that . options ; data . context = that . _renderUpload ( data . files ) . data ( 'data' , data ) . addClass ( 'processing' ) ; options . filesContainer [ options . prependFiles ? 'prepend' : 'append' ] ( data . context ) ; that . _forceReflow ( data . context ) ; that . _transition ( data . context ) ; data . process ( function ( ) { return $this . fileupload ( 'process' , data ) ; } ) . always ( function ( ) { data . context . each ( function ( index ) { $ ( this ) . find ( '.size' ) . text ( that . _formatFileSize ( data . files [ index ] . size ) ) ; } ) . removeClass ( 'processing' ) ; that . _renderPreviews ( data ) ; } ) . done ( function ( ) { data . context . find ( '.start' ) . prop ( 'disabled' , false ) ; if ( ( that . _trigger ( 'added' , e , data ) !== false ) && ( options . autoUpload || data . autoUpload ) && data . autoUpload !== false ) { data . submit ( ) ; } } ) . fail ( function ( ) { if ( data . files . error ) { data . context . each ( function ( index ) { var error = data . files [ index ] . error ; if ( error ) { $ ( this ) . find ( '.error' ) . text ( error ) ; } } ) ; } } ) ; }
The add callback is invoked as soon as files are added to the fileupload widget (via file input selection, drag & drop or add API call). See the basic file upload widget for more information:
The add callback is invoked as soon as files are added to the fileupload widget ( via file input selection drag & drop or add API call ) . See the basic file upload widget for more information :
File upload event handler