WordPress.org

Ready to get started?Download WordPress

Forums

Custom Upload Dir
[resolved] Any issue with changing folder paths? (13 posts)

  1. Seemap
    Member
    Posted 1 year ago #

    Hi Ulf
    This plugin looks ideal for what I want to do: change the upload dir for one particular custom post type.

    My question (before I go ahead and start uploading) is will there be any problem if I set the folder path for say "/%post_type%/%postname%", do my uploading and then revert back to the default folder for my normal posts? I might have to do this several times as I continue to add new custom post types and new regular posts. How will WordPress / your plugin handle this switching? Is it safe to do?

    I appreciate any advice you may have,

    Seemap

    http://wordpress.org/extend/plugins/custom-upload-dir/

  2. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    It should work, no problems. But do test first. :)

  3. Seemap
    Member
    Posted 1 year ago #

    Thanks for the reply. I did as you suggested. I found it only works if the base upload folder is kept the same. If you change that, then the file path for EVERY image on your blog (even previously uploaded ones) is changed, resulting in broken image links.

    However, if you only switch around the path templates, previously stored image paths are not affected. Hope this might help someone. Thanks for the plugin!

  4. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you very much for reporting that back. I'll add that info to the FAQ; it's very useful to be aware of.

  5. Seemap
    Member
    Posted 1 year ago #

    Yes, it basically means all uploads HAVE to be stored inside sub-folders of the base folder, it's not possible to have different top level or base upload folders as WordPress core can't handle more than one.

    Maybe a warning before you try to change the base path? Or no option at all in the plugin to change it? (as there is already an option to set the default upload folder in the WordPress settings).

  6. justinvempeny
    Member
    Posted 1 year ago #

    Dear ulfben, i installed custom custom-upload-dir plugin, my site is new, i dont have old images, so i can try more test with the plugin.
    After plugin installation im using /%year%/%monthnum%/%day% as my upload folder structure, but my current date detail are September 24, 2012, 2:24 pm. but the folder created in wrong way..folder created like this way
    wp-content/uploads/2012/08/11. How i can solve my issue and how can create wp-content/uploads/2012/09/24 (Year/Month/Date)structure...
    PLease suggest..
    Thanks in advance ...
    Justin Joseph

  7. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    Make sure the clock on your server is what you think it is.

  8. justinvempeny
    Member
    Posted 1 year ago #

    Dear iam using Godaddy linux shared hosting.
    i am going through the code in custom_upload_dir.php file `$date = explode(" ", date('Y m d H i s', $time));
    $tags = array('%post_id%','%postname%','%post_type%','%year%','%monthnum%','%month%', '%day%','%hour%','%minute%','%second%');
    $replace = array($post_id, $post_name, $post_type, $date[0], $date[1], $date[1], $date[2], $date[3], $date[4], $date[5]);`
    .. i'm trying to solve the issue..... :( new to programing... :(

  9. justinvempeny
    Member
    Posted 1 year ago #

    Dear pls have a look on these values, i just var_dump the vales ..

    $time=string(10) "1348590061"
    
    tags array=array(10) { [0]=> string(9) "%post_id%" [1]=> string(10) "%postname%" [2]=> string(11) "%post_type%" [3]=> string(6) "%year%" [4]=> string(10) "%monthnum%" [5]=> string(7) "%month%" [6]=> string(5) "%day%" [7]=> string(6) "%hour%" [8]=> string(8) "%minute%" [9]=> string(8) "%second%" }
    
    replace array=array(10) { [0]=> int(7) [1]=> string(7) "add-new" [2]=> string(4) "page" [3]=> string(4) "2012" [4]=> string(2) "08" [5]=> string(2) "08" [6]=> string(2) "11" [7]=> string(2) "12" [8]=> string(2) "55" [9]=> string(2) "49" }
    
    customdir=/%year%/%monthnum%/%day%
    
    //after $customdir = str_replace($tags,	$replace, $customdir); //do all cheap replacements in one go.
    
    customdir=/2012/08/11

    Pls check the values after str_replace function...

  10. justinvempeny
    Member
    Posted 1 year ago #

    Ohh man...
    this line $date = explode(" ", date('Y m d H i s', $time));
    making the issue with me.

    this code working correctly in a simple code with correct values, but didnt get correct values in plugin code :( :(

  11. justinvempeny
    Member
    Posted 1 year ago #

    Dear could you pls tell about this line (Line number: 133)
    $time = ($post->post_date == '0000-00-00 00:00:00') ? $time : strtotime($post->post_date);

    i just displayed this code
    REQUEST_TIME=1348595913
    time()=1348595914
    time varible=1348595913
    post->post_date:2012-08-11 12:55:49
    strtotime(post->post_date):1344689749
    time varible=1344689749

    here i can't understand from where post->post_date coming with 2012-08-11 12:55:49. From where??
    Please suggest.....

  12. ulfben
    Member
    Plugin Author

    Posted 1 year ago #

    It's the date and time you published the current post. Read the place holder tag descriptions.

  13. justinvempeny
    Member
    Posted 1 year ago #

    Dear thank you for your reply,
    The issue happened with my website because iam using one classified theme have different posts settings than wordpress default posts.
    I reduced number of thumbnails created by the theme code by editing theme code and wordpress code.Also i enabled your plugin, did some changes in the database tables.
    Now its working with me...

    Thank You
    So much for your plugin and support

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic