R
R
Rasul Gudantov2018-07-06 15:50:35
Laravel
Rasul Gudantov, 2018-07-06 15:50:35

How to work with external files using Laravel 5.6?

Illuminate\Support\Facades\File::get(...)
Illuminate\Support\Facades\Storage::put(...)

Standard facades only work with local storage.
PS Connect a file from another server/site

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iljaGolubev, 2018-07-06
@iljaGolubev

1. Add the desired directory to the config

// config/filesystems.php
    'disks' => [
        'temp' =>[
            'driver'=>'local',
            'root'=>sys_get_temp_dir()
        ],

2. Specify a disk
dd(\Illuminate\Support\Facades\Storage::disk('temp')->listContents());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question