Php 在Cpanel上上传Laravel项目中的图像
上传图片是我的职责,但问题是为什么图片没有上传到公共html文件夹?图片上传到项目的公共文件夹Php 在Cpanel上上传Laravel项目中的图像,php,laravel,Php,Laravel,上传图片是我的职责,但问题是为什么图片没有上传到公共html文件夹?图片上传到项目的公共文件夹 private function upload($image, $tbl) { $name = $image->getClientOriginalName(); $newName = date('ymdgis') . $name; $image->move(public_path() . '/img' . $tbl, $newName); retu
private function upload($image, $tbl)
{
$name = $image->getClientOriginalName();
$newName = date('ymdgis') . $name;
$image->move(public_path() . '/img' . $tbl, $newName);
return $newName;
}
在
AppServiceProvider
中,将此代码放入寄存器()
:
谢谢您,亲爱的先生,它成功了。如果有帮助,请将答案标记为已接受:)
public function register()
{
$this->app->bind('path.public', function() {
return base_path('../public_html');
});
}