Title: File path problems
Last modified: August 21, 2016

---

# File path problems

 *  [DataGnostics](https://wordpress.org/support/users/datagnostics/)
 * (@datagnostics)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/file-path-problems/)
 * I’m using Relocate Upload 0.22. I’m trying to get it running on my test server,
   which is IIS7 on Vista. My server contains more than one site, each a subfolder
   under `C:\inetpub\wwwroot`. Let’s call one I’m trying to set it up on is `C:\
   inetpub\wwwroot\mysite`.
 * When I first installed the plugin, the settings page said:
 *     ```
       Paths are relative to your blog's root folder: C:\inetpub\wwwroot
   
       Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(C:\inetpub\wwwrootc:\inetpub\wwwroot\mysite/wp-content/uploads) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\mysite\wp-content\plugins\relocate-upload\relocate-upload.php on line 247
   
       Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File(C:\inetpub\wwwrootc:) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\mysite\wp-content\plugins\relocate-upload\relocate-upload.php on line 247
       ```
   
 * I edited relocate-upload.php line 12 to be:
    `define('SERVER_DOC_ROOT', $GLOBALS['
   _SERVER']['DOCUMENT_ROOT'].'/mysite/');` The result:
 *     ```
       Paths are relative to your blog's root folder: C:\inetpub\wwwroot/gbotd/
   
       Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(C:\inetpub\wwwroot/gbotd/c:\inetpub\wwwroot\gbotd/wp-content/uploads) is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\gbotd\wp-content\plugins\relocate-upload\relocate-upload.php on line 251
   
       Warning: mkdir() [function.mkdir]: Invalid argument in c:\inetpub\wwwroot\gbotd\wp-content\plugins\relocate-upload\relocate-upload.php on line 251
       ```
   
 * Line 251 is:
    `f(!file_exists($new_dir)) mkdir( $new_dir, 0755, true );` — it’s
   slightly different from the original because I’ve added some comments as I’m 
   working.
 * Looking at the first error message, I decided to try changing line 248:
    `$new_dir
   = SERVER_DOC_ROOT . replace_month_year( $ru_folder['path'], date("Y-m") );` to:`
   $new_dir = replace_month_year( $ru_folder['path'], date("Y-m") );`
 * Now I get:
 *     ```
       Paths are relative to your blog's root folder: C:\inetpub\wwwroot/gbotd/
   
       Warning: mkdir() [function.mkdir]: open_basedir restriction in effect. File() is not within the allowed path(s): (C:\inetpub\wwwroot;C:\Windows\Temp) in c:\inetpub\wwwroot\mysite\wp-content\plugins\relocate-upload\relocate-upload.php on line 251
        new location
       ```
   
 * The Default location form seems to be displaying properly.
 * So, some of this seems to be related to an open_basedir problem — particularly
   frustrating because it seems to be turned off in php.ini.
 * But as for the rest, it looks to me as though something similar to what’s described
   in the comment at the end of the program is happening:
 *     ```
       // thing is if you have an absolute path to your file, WP will give you an url like
       // http://domain.co.uk/path_to/wp-content/uploads//home/useraccount/public_html/another_path_to/media/media_item.gif
       // note the double /
       //
       // as SERVER_DOC_ROOT = /home/useraccount/public_html
       //
       // we do a search for (http://.*?/).*?/SERVER_DOC_ROOT/ and replace with \1
       ```
   
 * but the fix isn’t working.
 * — Red Owl Web Design
 * [http://wordpress.org/plugins/relocate-upload/](http://wordpress.org/plugins/relocate-upload/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Tim Berneman](https://wordpress.org/support/users/tberneman/)
 * (@tberneman)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/file-path-problems/#post-4345387)
 * I will take a look at this issue in the next few days.
 * I’m about ready to release a new version with a cool new feature and a few fixes.
   The new feature gives you the ability to drag-n-drop your folders into a different
   order!
 *  Plugin Author [Tim Berneman](https://wordpress.org/support/users/tberneman/)
 * (@tberneman)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/file-path-problems/#post-4345458)
 * I haven’t forgotten you. I took a quick look but nothing jumped out at me. I 
   will be digging deeper into this issue and will let you know what I find.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘File path problems’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/relocate-upload.svg)
 * [Relocate Upload](https://wordpress.org/plugins/relocate-upload/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relocate-upload/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relocate-upload/)
 * [Active Topics](https://wordpress.org/support/plugin/relocate-upload/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relocate-upload/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relocate-upload/reviews/)

## Tags

 * [open_basedir](https://wordpress.org/support/topic-tag/open_basedir/)
 * [paths](https://wordpress.org/support/topic-tag/paths/)

 * 2 replies
 * 2 participants
 * Last reply from: [Tim Berneman](https://wordpress.org/support/users/tberneman/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/file-path-problems/#post-4345458)
 * Status: not resolved