I’m trying to change the permissions of the directory “uploads” (placed in /BWShop/immagini/uploads) to 777, but I’m not enable to change them, because when I click the “CHMOD” button, nothing happens
You cannot change CHMOD of a file/folder here in order to prevent people from locking themselves out of files/folders.
Is there a reason why you need to change the CHMOD to 777?
It’s possible the CHMOD functionality is disabled in the file manager. I’ve never encountered an issue that was fixed setting file permissions, and many issues that were caused by setting it incorrectly.
Can you please explain why you want to change the permissions in the first place? Maybe whatever problem you’re experiencing isn’t fixed by file permissions at all.
when i try to upload an image i get this error message from the php file, generated in the line where there is the instruction to upload the file. I figured it couldn’t find the directory because of the permissions. The error message is:
Warning: move_uploaded_file(/BWShop/immagini/uploads/utenteFemmina.png): failed to open stream: No such file or directory in /home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/php/AuthSys.php on line 420
Warning: move_uploaded_file(): Unable to move ‘/tmp/phpoe80et’ to ‘/BWShop/immagini/uploads/utenteFemmina.png’ in /home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/php/AuthSys.php on line 420
It seems to be a problem with your code. When it comes to including files, if you add slash to the beginning of the file location then the server will treat it as if it is supposed to be searched on root level which your account has no access to and will throw such error.
Without the slash the server will look for the file inside same directory as the executed php file which means no permission problems should occur.
The temporary name of the file is automatically generated, but now I’ve subtructed the first character from it, and this time it gave me no warnings, but the file upload fails anyway
$_FILES[$nomeCampoFile]["tmp_name"] = "/home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/immagini/uploads".$_FILES[$nomeCampoFile]["tmp_name"];
if(!move_uploaded_file($_FILES[$nomeCampoFile]["tmp_name"],$targetFile)){
var_dump($_FILES[$nomeCampoFile]["tmp_name"]);
var_dump($targetFile);
throw new Exception("Si sono verificati problemi con l'upload del file $filename");
}
But in the console, when I upload the image, it gave me this message: string(88) “/home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/immagini/uploads/tmp/phpepqh0Z”
string(42) “/BWShop/immagini/uploads/utenteFemmina.png”
Si sono verificati problemi con l’upload del file utenteFemmina.png
So the function move_uploaded_file($_FILES[$nomeCampoFile][“tmp_name”],$targetFile) has returned false
You are so close but need to do some modification here is the code which should work hopefully:
$targetFile = "/home/vol18_2/infinityfree.com/if0_34794448/htdocs".$targetFile;
if(!move_uploaded_file($_FILES[$nomeCampoFile]["tmp_name"],$targetFile)){
var_dump($_FILES[$nomeCampoFile]["tmp_name"]);
var_dump($targetFile);
throw new Exception("Si sono verificati problemi con l'upload del file $filename");
}