douhuanqiao5290 2019-07-14 21:24
浏览 88

无法在AWS EC2上移动php中的文件

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 :)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥85 maple软件,solve求反函数,出现rootof怎么办?
    • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
    • ¥65 汇编语言除法溢出问题
    • ¥15 Visual Studio问题
    • ¥20 求一个html代码,有偿
    • ¥100 关于使用MATLAB中copularnd函数的问题