【发布时间】:2019-12-26 08:19:17
【问题描述】:
我正在尝试使用 PHP 上传文件。我可以在“本地服务器”中执行此操作,但它在“远程服务器”中不起作用[本文底部的输出]。
前端
<form method="post" action="{{ route('debug.testupload') }}" enctype="multipart/form-data">
<input type="file" name="photo">
<input type="submit" class="btn mt-10 mt-sml-20" value="Submit">
</form>
后端
public function testProcessSubmit(Request $request){
echo (sys_get_temp_dir());
dd($_FILES);
return "0";
}
输出(本地服务器)
]
输出(远程服务器)
- 这是我服务器中的 php 配置:
- file_uploads:开启
- upload_max_filesize: 2M
- max_file_uploads: 20
编辑 允许 /tmp: 777
【问题讨论】:
-
什么是远程服务器上的文件权限?
-
/tmp 的权限为 777
-
request()->image->move(public_path('images'), $imageName);在哪里? -
"upload_max_filesize: 2M" - 查看本地服务器的屏幕截图,文件(因为您似乎发布了相同的文件)似乎是 4MB,这是最大尺寸的两倍。
-
Why not upload images of code on SO when asking a question?(如果您的 ini 设置列在先前测试的错误/大小转储旁边,您很可能已经看到了罪魁祸首)。