【发布时间】:2021-04-09 20:51:12
【问题描述】:
我在 CPanel 中托管了一个 Laravel 项目,它正在运行,但是当我上传图像时,它应该存储在公共文件夹中,例如 ("public_path()/posts/theactualimage.jpeg")。
图像路径存储在数据库中,但真正的图像实际上根本没有存储
在我的本地机器上一切都很顺利,但在主机上却没有
不知道有没有什么配置需要...
这是文件夹的结构
./
| public_html
| | posts
| | index.php
| | some other files
|
| myapp
| | all the other files controllers views ...
这是存储图像的函数
public function uploadImage($location, $imageName){
$name = $imageName->getClientOriginalName();
$imageName->move(public_path().'/'.$location, date('ymdgis').$name);
return date('ymdgis').$name;
}
我没有使用链接存储
谢谢你的帮助
【问题讨论】:
-
您没有在您的函数中收到您的请求。你希望它如何移动图像?
-
图像是在本地主机上运行时存储的,但问题实际上出在共享主机上