问题描述
在我的主机上,我有'public_html'
,而不是"public"目录名我已将公共路径绑定到public_html directory in index.php
文件
On my hosting, I have 'public_html'
, not 'public' directory name II have bind public path to the public_html directory in index.php
file
$app->bind('path.public', function() {
return base_path().'/public_html';
});
现在public_path()辅助函数返回带有public_html的路径(正确)
now public_path() helper returns me path with public_html (correct)
而且,我的磁盘在filesystem.php
文件中
What is more, i have my disk in the filesystem.php
file
'my_upload' => [
'driver' => 'local',
'root' => public_path().'/images/adverts',
'visibility' => 'public',
],
一切对我来说都很好,但是当我上传一些文件时,laravel将它们放在'public' directory
中.我需要将它们放在'public_html'
中.
Everything looks fine for me, but when I upload some files, laravel put them in 'public' directory
. I need to have them in 'public_html'
.
(我需要公共目录中的图像,因为我的主机不提供链接做存储文件夹)
(I need images in public directory becouse my hosting does not provide link do storage folder)
预先感谢
推荐答案
尝试存储如下文件:
if(!Storage::disk('my_upload')->put($path, $file_content)) {
return false;
}
这篇关于laravel,如何将图像存储到public_html目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!