Changeset 24463 for trunk/wp-admin/includes/file.php
- Timestamp:
- 06/21/2013 02:29:26 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r23739 r24463 329 329 // Move the file to the uploads dir 330 330 $new_file = $uploads['path'] . "/$filename"; 331 if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) 332 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); 331 if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) { 332 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) 333 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; 334 else 335 $error_path = basename( $uploads['basedir'] ) . $uploads['subdir']; 336 337 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_path ) ); 338 } 333 339 334 340 // Set correct file permissions … … 453 459 $new_file = $uploads['path'] . "/$filename"; 454 460 if ( false === @ rename( $file['tmp_name'], $new_file ) ) { 455 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); 461 if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) 462 $error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir']; 463 else 464 $error_path = basename( $uploads['basedir'] ) . $uploads['subdir']; 465 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_path ) ); 456 466 } 457 467
Note: See TracChangeset
for help on using the changeset viewer.