Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to fix avatar “is not within the allowed path”

  • Avatar of rydwant
    rydwant
    Participant

    @rydwant

    How to fix the following errors:
    PHP Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/xxxxxx/public_html/wp-content/themes/mythemes/framework/utilities/media-functions.php on line 48

    and on line 48 of media-functions.php files:

    if (!file_exists($file_path)) {
    // simple fix for direct links to images on multi-site installs
    if (isset($blog_id) && $blog_id > 0) {
    // uploaded images to media folders
    $imageParts = explode(‘/files/’, $img_url, 2);
    if (isset($imageParts[1])) {
    $img_url = get_site_url(1) .’/wp-content/blogs.dir/’. $blog_id .’/files/’. $imageParts[1];
    $file_path = parse_url( $img_url );
    $file_path = $_SERVER . $file_path;
    }
    // if not found in media folders check theme folders
    if (!file_exists($file_path)) {
    // files in the theme folder
    $imageParts = explode(THEME_URL, $img_url, 2);
    if (isset($imageParts[1])) {
    $file_path = THEME_DIR . $imageParts[1];
    }
    }
    }
    }

You must be logged in to reply to this topic.