Changeset 18482 for trunk/wp-admin/includes/file.php
- Timestamp:
- 07/29/2011 08:59:35 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/file.php
r18447 r18482 324 324 $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); 325 325 326 $tmp_file = wp_tempnam($filename); 327 326 328 // Move the file to the uploads dir 329 if ( false === @ move_uploaded_file( $file['tmp_name'], $tmp_file ) ) 330 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) ); 331 332 // If a resize was requested, perform the resize. 333 $do_resize = apply_filters( 'wp_upload_resize', isset( $_REQUEST['image_resize'] ) ); 334 $size = @getimagesize( $tmp_file ); 335 if ( $do_resize && $size ) { 336 $old_temp = $tmp_file; 337 $tmp_file = image_resize( $tmp_file, (int) get_option('large_size_w'), (int) get_option('large_size_h'), 0, 'resized'); 338 if ( ! is_wp_error($tmp_file) ) { 339 unlink($old_temp); 340 } else { 341 $tmp_file = $old_temp; 342 } 343 } 344 345 // Copy the temporary file into its destination 327 346 $new_file = $uploads['path'] . "/$filename"; 328 if ( false === @ move_uploaded_file( $file['tmp_name'], $new_file ) )329 return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ));330 347 copy( $tmp_file, $new_file ); 348 unlink($tmp_file); 349 331 350 // Set correct file permissions 332 351 $stat = stat( dirname( $new_file ));
Note: See TracChangeset
for help on using the changeset viewer.