From bb94e702f82f73c7da45f390ef490fad02469815 Mon Sep 17 00:00:00 2001 From: duck_ Date: Tue, 28 Feb 2012 20:02:43 +0000 Subject: [PATCH] Drop image resizing code from wp_handle_upload(). Fixes #19800. This code stops wp_handle_upload() from reporting errors when the upload couldn't be moved to its final local and it was a non-JS fallback that is unused. git-svn-id: http://svn.automattic.com/wordpress/trunk@20019 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 2954a7c724..a00bed563d 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -323,30 +323,10 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) { $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); - $tmp_file = wp_tempnam($filename); - // Move the file to the uploads dir - if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) ) - return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); - - // If a resize was requested, perform the resize. - $image_resize = isset( $_POST['image_resize'] ) && 'true' == $_POST['image_resize']; - $do_resize = apply_filters( 'wp_upload_resize', $image_resize ); - $size = @getimagesize( $tmp_file ); - if ( $do_resize && $size ) { - $old_temp = $tmp_file; - $tmp_file = image_resize( $tmp_file, (int) get_option('large_size_w'), (int) get_option('large_size_h'), 0, 'resized'); - if ( ! is_wp_error($tmp_file) ) { - unlink($old_temp); - } else { - $tmp_file = $old_temp; - } - } - - // Copy the temporary file into its destination $new_file = $uploads['path'] . "/$filename"; - copy( $tmp_file, $new_file ); - unlink($tmp_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'] ) ); // Set correct file permissions $stat = stat( dirname( $new_file ));