如何将laravel 5.3中的存储路径更改为公共路径?

如何将laravel 5.3中的存储路径更改为公共路径?,laravel,laravel-5,laravel-5.3,Laravel,Laravel 5,Laravel 5.3,在laravel 5.3中,如果我从表单上传文件,它将存储在自己的存储目录中。然后我应该在公共路径中创建一个指向该存储路径的符号链接 由于限制,我无法在系统上创建符号链接。如何将文件直接上载到public/uploads而不是storage/app/uploads 我试图在AppServiceProvider.php中设置路径,但没有成功 public function register() { //not working: $this->app->useStorag

laravel 5.3
中,如果我从表单上传文件,它将存储在自己的存储目录中。然后我应该在公共路径中创建一个指向该存储路径的
符号链接

由于限制,我无法在系统上创建符号链接。如何将文件直接上载到
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';
    // });

}
“不工作”是指它仍在上传到默认存储目录。我还清除了缓存

以下是上传部分(在控制器中使用):


谢谢你的提示。:)

在Laravel5中,您现在必须在
config/filesystems.php
中执行此操作。您可以添加新磁盘,如下所示:

'disks' => [

    'uploads' => [
          'driver' => 'local',
          'root'   => public_path(), // previously storage_path();
    ],

]
然后执行以下操作以使用它:

Storage::disk('uploads')->put('filename', $file_content);

谢谢!:)它起作用了。在我的示例中,我从表单上传了一个图像。我也可以使用我的“上传”磁盘:$request->image->storeAs($upload\u dir,“upload\u image.jpg”,“uploads”)@乔治·H,看来你是拉威尔大师。我需要你的帮助。看这里:如何从Storage::url访问文件?
Storage::disk('uploads')->put('filename', $file_content);