将文件存储在Laravel 5根文件夹之外

Sil*_*let 6 laravel laravel-5

我正在开发一个laravel 5项目并使用imag存储图像文件.我想将我的图像文件存储在项目根文件夹之外的文件夹中.我现在卡住了应该存储图像文件的外部文件夹,我想通过像http://cdn.example.com这样的子域访问它.期待你的解决方案.

Mar*_*nJH 7

laravel文档可以给你伸出援助之手.

否则你可以去config/filesystems.php并为本地和生产添加你自己的自定义存储路径:

return [

    'default' => 'custom',
    'cloud' => 's3',
    'disks' => [

        'local' => [
            'driver' => 'local',
            'root'   => storage_path().'/app',
        ],

        'custom' => [
            'driver' => 'custom',
            'root'   => '../path/to/your/new/storage/folder',
        ],

        's3' => [
            'driver' => 's3',
            'key'    => 'your-key',
            'secret' => 'your-secret',
            'region' => 'your-region',
            'bucket' => 'your-bucket',
        ],

        'rackspace' => [
            'driver'    => 'rackspace',
            'username'  => 'your-username',
            'key'       => 'your-key',
            'container' => 'your-container',
            'endpoint'  => 'https://identity.api.rackspacecloud.com/v2.0/',
            'region'    => 'IAD',
        ],

    ],
];
Run Code Online (Sandbox Code Playgroud)