[wp-trac] [WordPress Trac] #14627: wp_handle_upload unique_filename_callback problem

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 17 15:22:11 UTC 2010


#14627: wp_handle_upload unique_filename_callback problem
--------------------------+-------------------------------------------------
 Reporter:  xiosen        |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Upload        |     Version:  3.0.1          
 Severity:  major         |    Keywords:  needs-patch    
--------------------------+-------------------------------------------------
 Right now I am using wp_handle_upload to upload a file and I would like to
 provide a custom filename using the unique_filename_callback parameter.

 If you look at 3.0.1 wp-includes/functions.php line 2218 inside the
 wp_unique_filename function. You will see that $dir, $name are passed into
 the callback function. However, the $name parameter is the filename
 without the extension, so the only thing missing is $ext. A callback
 function is unable to generate a proper filename without the original ext
 the file is in.

 Line 2218 needs to look like:
 $filename = $unique_filename_callback( $dir, $name, $ext );

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14627>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list