We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28100
    • 66 Posts
    I get the following error when trying to upload a user photo/pic:

    « PHP Parse Error »
     
    PHP error debug
      Error: 	move_uploaded_file(/home/spacefish/public_html/sites/sitename/reddog.gif) [function.move-uploaded-file]: failed to open stream: Permission denied	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/home/spacefish/public_html/sites/sitename/assets/snippets/webloginpe/webloginpe.class.php	 
      Line: 	2503	 
      Line 2503 source: 	if (!move_uploaded_file($_FILES['photo']['tmp_name'], $userImage))


    The lines in the php file:

    function CreateUserImage()
    	{
    		global $modx;
    		
    		$imageAttributes = str_replace(', ', ',', $this->UserImageSettings);
    		$imageAttributes = explode(',', $imageAttributes);
    		
    		if ($_FILES['photo']['size'] >= $imageAttributes[0])
    		{
    			$sizeInKb = round($imageAttributes[0] / 1024);
    			$sizeError = str_replace('[+000+]', $sizeInKb, $this->LanguageArray[28]);
    			return $this->FormatMessage($sizeError);
    		}
    		
    		$userImage = $modx->config['base_path'].strtolower(str_replace(' ', '-', basename( $_FILES['photo']['name'])));
    		if (!move_uploaded_file($_FILES['photo']['tmp_name'], $userImage))
    		{
    			return $this->FormatMessage($this->LanguageArray[29]);
    		}



    Does anyone know what file do I need to change the permissions of -- or is there something I need to change in the configuration section?

    Thanks! smiley

    ~ Edit.  PHP is 5.2.5

    ~ Edit 2. This post HERE fixed it. smiley