I am trying to replace the uploaded file into a location.
My code is:
if (isset($_FILES['image']['name']))
{
$saveto = 'img/$user.jpg'; //$user would be the name of the current user.
move_uploaded_file($_FILES['image']['tmp_name'], $saveto);
}
I'm getting this error,
Warning: move_uploaded_file(img/$user.jpg): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/profile.php on line 33
Although the permissions are set, sudo chmod 777
. It is still giving me this error, what is the problem? Thanks