WP Plupload: on FileUploaded
, allow success
and error
callbacks to receive server responses after a successful upload.
Props ippetkov. Fixes #24934. git-svn-id: https://develop.svn.wordpress.org/trunk@34009 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
47287f8d51
commit
6a37ad1464
@ -262,10 +262,13 @@ window.wp = window.wp || {};
|
||||
return error( pluploadL10n.default_error, e, file );
|
||||
}
|
||||
|
||||
if ( ! _.isObject( response ) || _.isUndefined( response.success ) )
|
||||
if ( ! _.isObject( response ) || _.isUndefined( response.success ) ) {
|
||||
return error( pluploadL10n.default_error, null, file );
|
||||
else if ( ! response.success )
|
||||
return error( response.data && response.data.message, response.data, file );
|
||||
} else if ( ! response.success && ! _.isObject( response.data ) ) {
|
||||
return error( response.data, null, file );
|
||||
} else {
|
||||
return error( response.data.message || pluploadL10n.default_error, response.data, file );
|
||||
}
|
||||
|
||||
_.each(['file','loaded','size','percent'], function( key ) {
|
||||
file.attachment.unset( key );
|
||||
@ -281,7 +284,7 @@ window.wp = window.wp || {};
|
||||
if ( complete )
|
||||
Uploader.queue.reset();
|
||||
|
||||
self.success( file.attachment );
|
||||
self.success( file.attachment, response.data );
|
||||
});
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user