[wp-trac] Re: [WordPress Trac] #6762: Would be useful for wp_upload_dir to be able to return without date sub directories

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 18 01:19:48 GMT 2008


#6762: Would be useful for wp_upload_dir to be able to return without date sub
directories
---------------------------+------------------------------------------------
 Reporter:  simonwheatley  |        Owner:  anonymous
     Type:  enhancement    |       Status:  new      
 Priority:  normal         |    Milestone:  2.6      
Component:  General        |      Version:           
 Severity:  normal         |   Resolution:           
 Keywords:  has-patch      |  
---------------------------+------------------------------------------------
Comment (by DD32):

 A Better method would be to simply return 'base_dir' in the $uploads array
 rather than turning it on/off via a seperate arguement. (See patch)

 I needed exactly the same thing in another plugin, but instead i used this
 in combination with wp_upload_dir():
 {{{
 $uploads_folder = defined('UPLOADS') ? UPLOADS :
 (trim(get_option('upload_path')) === '' ? 'wp-content/uploads' :
 get_option('upload_path'));
 }}}

 Another way now that i look at the code again, would be to simply to trim
 $subdir off the end of the $dir and $url return vals.. But its ugly and
 could cause problems if the subdir is empty.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6762#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list