Show a relative path in an upload error message.
git-svn-id: https://develop.svn.wordpress.org/trunk@24463 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
626e77ec3b
commit
9e8a91cd05
|
@ -328,8 +328,14 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) {
|
||||||
|
|
||||||
// Move the file to the uploads dir
|
// Move the file to the uploads dir
|
||||||
$new_file = $uploads['path'] . "/$filename";
|
$new_file = $uploads['path'] . "/$filename";
|
||||||
if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
|
if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
|
||||||
return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
|
if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
|
||||||
|
$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
|
||||||
|
else
|
||||||
|
$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
|
||||||
|
|
||||||
|
return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_path ) );
|
||||||
|
}
|
||||||
|
|
||||||
// Set correct file permissions
|
// Set correct file permissions
|
||||||
$stat = stat( dirname( $new_file ));
|
$stat = stat( dirname( $new_file ));
|
||||||
|
@ -452,7 +458,11 @@ function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
|
||||||
// Move the file to the uploads dir
|
// Move the file to the uploads dir
|
||||||
$new_file = $uploads['path'] . "/$filename";
|
$new_file = $uploads['path'] . "/$filename";
|
||||||
if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
|
if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
|
||||||
return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
|
if ( 0 === strpos( $uploads['basedir'], ABSPATH ) )
|
||||||
|
$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
|
||||||
|
else
|
||||||
|
$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
|
||||||
|
return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_path ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set correct file permissions
|
// Set correct file permissions
|
||||||
|
|
Loading…
Reference in New Issue