[wp-trac] [WordPress Trac] #10559: Allow a custom subdir in wp_upload_dir

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 6 23:13:39 UTC 2009


#10559: Allow a custom subdir in wp_upload_dir
----------------------------+-----------------------------------------------
  Reporter:  aaroncampbell  |        Type:  enhancement            
    Status:  closed         |    Priority:  normal                 
 Milestone:  2.9            |   Component:  Upload                 
   Version:                 |    Severity:  normal                 
Resolution:  invalid        |    Keywords:  has-patch needs-testing
----------------------------+-----------------------------------------------
Changes (by aaroncampbell):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 Good point.  I don't know why I missed the obvious.  Here is what I did
 for anyone else ending up here with a similar issue:
 {{{
 add_filter('upload_dir', 'my_upload_dir');
 $upload = wp_upload_dir();
 remove_filter('upload_dir', 'my_upload_dir');

 funcion my_upload_dir($upload) {
         $upload['subdir']       = '/sub-dir-to-use' . $upload['subdir'];
         $upload['path']         = $upload['basedir'] . $upload['subdir'];
         $upload['url']          = $upload['baseurl'] . $upload['subdir'];
         return $upload;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10559#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list