Make WordPress Core

Ticket #6450: file_upload_move_error.patch

File file_upload_move_error.patch, 700 bytes (added by simonwheatley, 18 years ago)

Patch to fix uploaded file movement error notification

  • wp-admin/includes/file.php

    old new  
    172172
    173173        // Move the file to the uploads dir
    174174        $new_file = $uploads['path'] . "/$filename";
    175         if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )
    176                 wp_die( printf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ));
     175        if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) ) {
     176                return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
     177        }
    177178
    178179        // Set correct file permissions
    179180        $stat = stat( dirname( $new_file ));