WordPress.org

Ready to get started?Download WordPress

Forums

Relocate Upload
[resolved] Sub directories are not made before moving (1 post)

  1. shawnpyle
    Member
    Posted 1 year ago #

    Default folder: [project root]/wp-content/uploads/%YEAR%/%MONTH%/
    MP3 folder: [project root]/wp-content/uploads/mp3/%YEAR%/%MONTH%/

    However, when I go to move a file, the mp3 directory is made but none of the sub directories and was causing this error:
    Warning: rename([project root]/wp-content/uploads/2012/09/test.mp3, [project root]/wp-content/uploads/2012/09/test.mp3) [function.rename]: No such file or directory in [project root]/wp-content/plugins/relocate-upload/relocate-upload.php on line 52

    I was able to solve this by adding the following to the relocate-upload.php file starting on line 49 before the // attempt to move the file:

    // create directory if needed
       $new_dir = dirname($new_path);
       if(!file_exists($new_dir)) mkdir($new_dir,0777,true);

    http://wordpress.org/extend/plugins/relocate-upload/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic