[wp-trac] [WordPress Trac] #17425: Add filter for $uploads in wp_handle_upload

WordPress Trac wp-trac at lists.automattic.com
Fri May 13 20:16:42 UTC 2011


#17425: Add filter for $uploads in wp_handle_upload
-------------------------+-----------------------------
 Reporter:  iandunn      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Media        |    Version:
 Severity:  minor        |   Keywords:  needs-patch
-------------------------+-----------------------------
 Right now there isn't any way for a plugin to set a custom directory for
 file uploads. I understand that in most cases they should be placed in the
 default directory, but there are circumstances where this isn't desirable.
 For instance, I'm building a custom post type for a client, and they have
 a separate application that it will integrate with. That application has
 to have the files in a specific directory structure which can't be
 changed.

 The only thing needed to get around this is a filter on $uploads.

 {{{
 $filename = wp_unique_filename( $uploads['path'], $file['name'],
 $unique_filename_callback ); // unmodified, just here to show placement
 $uploads = apply_filters( 'wp_handle_upload_uploads', $uploads );
 }}}

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


More information about the wp-trac mailing list