I'm uploading images to my server and when I try to call 'move_uploaded_file' it says "unable to move" even though I have given all the folders and their parents permissions to read and write (tried 775 and 777).
I also have an API that my Android app is using and I convert the image on the app from png to base64 string and transfer that string to the server as a query in the API POST request, and then on the server I convert the string back to an image, and it's all working great but when I try to move the image to my 'images' directory it says "failed to open stream: Permission denied" even though I have given permissions for both the temp and the images directories.
Here's the code I use for when the user uploads the images using the website:
move_uploaded_file($_FILES["file"]["tmp_name"], $location);
And here's for the API
file_put_contents($location,base64_decode($photo));
- I'm using EC2 instance on AWS running fedora with apache and the code is of course php..
- On my localhost the code works as it should with no errors, and also I have different server on DigitalOcean running the same code and there it works great as well, It's only on AWS / fedora where I have this problem.
I'd love to get some help with this problem :)