skip to Main Content

I’ve followed the steps of Laracasts, but it’s not working.

When I submit the form it returns:

Done: storage/thumbnails/k0TF3NW6WvWWjHuEtZ0OW7TTRQbfSB6lvD1GJls3.png

But I couldn’t find it anywhere. My storage/thumbnails is empty.

My Controller:

  $path = request()->file('thumbnail')->store('storage/thumbnails');
  return 'Done: ' . $path;

My filesystems.php

'default' => env('FILESYSTEM_DRIVER', 'public'),


        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

How can I find the uploaded file? Thanks!

2

Answers


  1. Could you try this code please.

    $file = $request->file('thumbnail');
    $file_name = uniqid()."_".time().'.'.$file->extension();
    $file_location = '/thumbnail/';
    $file-> move(storage_path($file_location), $file_name);
    

    I hope the code helps you. Have a good one 🙂

    Login or Signup to reply.
  2. Have you tried "php artisan storage:link" command?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search