get file laravel code example

Example 1: laravel get file name

$path = $request->image->getClientOriginalName();

Example 2: laravel storage get file path

use Illuminate\Support\Facades\Storage;

$path = Storage::path('file.jpg');

Example 3: laravel get file contents from storage

$contents = Storage::disk('local')->get('file.txt');

Example 4: laravel link storage to public

php artisan storage:link

Example 5: laravel store file

$path = $request->file('avatar')->store(
    'avatars', 'public'
);

Example 6: laravel filesystem

$exists = Storage::disk('s3')->exists('file.jpg');

Tags:

Php Example