Improve consistency in wp.Uploader callbacks; pass file objects to all handlers. see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@21656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-08-29 19:56:42 +00:00
parent 16b01d701e
commit c2e9648620

View File

@ -130,7 +130,9 @@ if ( typeof wp === 'undefined' )
$('#' + this.uploader.id + '_html5_container').hide();
}
this.uploader.bind( 'UploadProgress', this.progress );
this.uploader.bind( 'UploadProgress', function( up, file ) {
self.progress( file );
});
this.uploader.bind( 'FileUploaded', function( up, file, response ) {
try {
@ -143,10 +145,10 @@ if ( typeof wp === 'undefined' )
return self.error( pluploadL10n.default_error );
if ( 'error' === response.type )
return self.error( response.data.message, response.data );
return self.error( response.data.message, response.data, file );
if ( 'success' === response.type )
return self.success( response.data );
return self.success( response.data, file );
});
@ -162,7 +164,7 @@ if ( typeof wp === 'undefined' )
}
}
self.error( message, error );
self.error( message, error, error.file );
up.refresh();
});