We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38585
    • 22 Posts
    When uploading a file via the hyperlink button in the WYSIWYG, I receive this error:

    Error, "Failed to upload file, internal error..."

    My server log says:

    PHP Warning: file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/var/www/vhosts/removed/httpdocsassets/plugins/seturl_js_tinymce.inc) is not within the allowed path(s): (/var/www/vhosts/removed/httpdocs/:/tmp/) in /var/www/vhosts/removed/httpdocs/manager/media/browser/mcpuk/browser.php on line 17, referer: http://removed/assets/plugins/tinymce/jscripts/tiny_mce/plugins/advlink/link.htm

    Contents of browser.php

    <?php
    
    define('MODX_BASE_PATH', realpath('../../../../'));
    $rb = new FBROWSER();
    $ph = array();
    $ph['seturl_js'] = $rb->seturl_js();
    $output = $rb->render_fbrowser($ph);
    echo $output;
    
    class FBROWSER
    {
    	function seturl_js()
    	{
    		$seturl_js_filename = 'seturl_js_'  . htmlspecialchars($_GET['editor']) . '.inc';
    		$seturl_js_path = MODX_BASE_PATH . 'assets/plugins/';
    		
    		if(file_exists($seturl_js_path . $seturl_js_filename))
    		{
    			$result = file_get_contents($seturl_js_path . $seturl_js_filename);
    		}
    		else
    		{
    			$editor_path = htmlspecialchars($_GET['editorpath'], ENT_QUOTES);
    			switch($_GET['editor'])
    			{
    				case 'tinymce' :
    				case 'tinymce3':
    					$result = file_get_contents('seturl_js_tinymce.inc');
    					$result = str_replace('[+editor_path+]', $editor_path, $result);
    					break;
    				default:
    				$result = '<script src="seturl.js" type="text/javascript"></script>' . PHP_EOL;
    			}
    		}
    		return $result;
    	}
    	
    	function render_fbrowser($ph)
    	{
    		$browser_html = file_get_contents('browser.html.inc');
    		$browser_html2 = $browser_html;
    		foreach($ph as $name => $value)
    		{
    			$name = '[+' . $name . '+]';
    			$browser_html = str_replace($name, $value, $browser_html);
    		}
    		return $browser_html;
    	}
    }
    


    I've tried updating the file path in browser.php and the Configuration settings for file path.

    Please advise. Evo. 1.0.6.
      • 19369
      • 1,098 Posts
      Did you set the right permissions on the "images" and "file" folders?
        • 38585
        • 22 Posts
        Thanks, cycling permissions on and off has done the trick.