php - 图片上传到 TMP 文件位置不正确
问题描述
使用下面的代码,它应该上传到 $path 中指定的路径,但由于某种原因,它会将所有图片的链接保存到 c:\xampp\tmp,扩展名为 .tmp,但无论如何都会将它们移动到正确的文件夹中。我做错了什么?
public function store(Request $request){
//
if($file = $request->file('image')){
$name = $file->getClientOriginalName();
$path = 'public/images';
if($file->move($path, $name)){
$post = new Gallery();
$post->image = $request->image;
$post->name = $request->name;
$post->species_id = $request->species_id;
$post->tag = $request->tag;
$post->patreon = $request->tag;
$post->save();
return redirect()->route('admin.gallery.index');
};
};
}
解决方案
推荐阅读
- sql - 在 Where 子句中使用另一个局部变量从局部变量中选择的困难
- spring - Spring“SchedulerFactoryBean”覆盖“jobstore”属性值
- php - 使用php根据同页表单的输入动态输出html表格
- python - 单击tkinter中的按钮后小部件消失?
- c++ - 为什么使用 Xor 运算符在选择排序中交换对象不起作用?
- android - 关闭弹出的博览会应用程序后,无头服务停止工作
- c - 在 osx 上编译简单 C 程序时找不到标头错误
- rust - 如何在 Rust 中将所有运算符重载组合组合成一个特征?
- android - 字符串字节数据到字节数组
- python - 为什么 setattr 不影响返回值?