场景,使用thinkphp6自带文件上传功能上传图片,保存路径在服务器根目录下的文件夹,如:/usr/local/nginx/html/static/images;

上传配置文件如图:
thinkphp6 Impossible to create the root directory

图片上传报错,返回接口返回如图所示:
thinkphp6 Impossible to create the root directory
这里没看出什么问题,查看thinkphp日志文件
如图:
thinkphp6 Impossible to create the root directory

错误信息:Impossible to create the root directory
linux服务器权限问题
进入目录,修改权限
cd /usr/local/nginx/html/static/images

chmod -R 777 avatar/

再上传文件,如图:
thinkphp6 Impossible to create the root directory

解决报错,成功上传。
检测服务器是否有该文件,如图:
thinkphp6 Impossible to create the root directory

相关文章: