将文件存储在Laravel 5根文件夹之外 [英] Storing files outside the Laravel 5 Root Folder

查看:60
本文介绍了将文件存储在Laravel 5根文件夹之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发laravel 5项目,并使用imaging存储图像文件.我想将图像文件存储在项目的根文件夹之外的文件夹中.我现在被困在应该存储图像文件的外部文件夹中,我想使其可以通过子域访问,例如

I am developing a laravel 5 project and storing image files using imagine. I would want to store my image files in a folder outside the project's root folder. I am stuck at the moment The external folder where image files are supposed to be stored, I want to make it accessible via a sub-domain something like http://cdn.example.com Looking towards your solutions.

推荐答案

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

The laravel documentation could give you a helping hand.

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

Otherwise you could go to config/filesystems.php and add your own custom storage path for both local and production:

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',
        ],

    ],
];

这篇关于将文件存储在Laravel 5根文件夹之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆