For some reason, she does not want to upload a file, writes that there are no rights, although they are exposed.
Code:
<?php $uploaddir = dirname(getcwd()).'/img/'; $uploadfile = $uploaddir . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) { echo json_encode([ "Message" => "The file ". basename($_FILES["file"]["name"]). " has been uploaded.", "Status" => "OK" ]); } else { echo json_encode([ "Message" => "Sorry, there was an error uploading your file.", "Status" => "Error" ]); } ?> Conclusion:
Warning: move_uploaded_file(/Applications/XAMPP/xamppfiles/img/123.jpg): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/upload.php on line 6 Warning: move_uploaded_file(): Unable to move '/Applications/XAMPP/xamppfiles/temp/phpWdbwtd' to '/Applications/XAMPP/xamppfiles/img/123.jpg' in /Applications/XAMPP/xamppfiles/htdocs/upload.php on line 6 {"Message":"Sorry, there was an error uploading your file.","Status":"Error"} I tried:
sudo CHMOD 775 /Applications/XAMPP/xamppfiles/htdocs/upload.php
sudo chmod -R 0755 /Applications/XAMPP/xamppfiles/htdocs/upload.php
sudo chown nobody /Applications/XAMPP/xamppfiles/htdocs/upload.php
I am also entitled to the file and folders everyone - read & write