在laravel 5.3
,如果我从表单上传文件,它将存储在自己的存储目录中。然后我应该在公共路径中创建一个symlink
到该存储路径的路径。
由于限制,我不能在我的系统上创建符号链接。如何将文件直接上传到public/uploads
而不是storage/app/uploads
?
我试图设置路径,AppServiceProvider.php
但它不起作用。
public function register()
{
//not working:
$this->app->useStoragePath( $this->app->basePath() . "/upload");
//also not working:
// $this->app->bind('path.storage', function () {
// return $this->app->basePath() . '/upload';
// });
}
“不工作”是指它仍在上传到默认存储目录。我还清除了缓存。
这是上传部分(在控制器中使用):
$request->image->storeAs("uploads", "uploaded_image.jpg");
感谢您的任何提示。:)