[Server]App-Retrofit上传文件

来源:互联网 发布:网页游戏网络加速器 编辑:程序博客网 时间:2024/05/17 02:45

最近琢磨自己封装一下Retrofit库,基本的get,post都搞定了。在弄上传的时刻遇到了一个坑,就是上传文件总提示无法放到指定的文件夹,提示move_uploaded_file(folderpath): failed to open stream: Permission denied。虽然写的是php环境,但是这句话肯定是用户没有权限。果断google+stackoverflow。
解决方案
http://stackoverflow.com/questions/8103860/move-uploaded-file-gives-failed-to-open-stream-permission-denied-error-after。
我这边执行ps aux | grep httpd得到的结果是

_www              8719   0.0  0.1  2488572   5952   ??  S    11:22AM   0:00.11 /usr/sbin/httpd -D FOREGROUND_www              3195   0.0  0.1  2488828   7344   ??  S    Wed09AM   0:00.19 /usr/sbin/httpd -D FOREGROUND_www              1270   0.0  0.1  2488316   5296   ??  S    Tue11AM   0:00.35 /usr/sbin/httpd -D FOREGROUND_www               357   0.0  0.1  2488316   5052   ??  S    Tue09AM   0:00.38 /usr/sbin/httpd -D FOREGROUNDroot                96   0.0  0.0  2479584   4052   ??  Ss   Tue09AM   0:01.51 /usr/sbin/httpd -D FOREGROUND

因为是手机上传文件,所以将文件夹设置为指定的用户_www

sudo chown _www folderpath

再次在手机上执行,文件上传成功。

0 0
原创粉丝点击