Search code examples
laravellaravel-5laravel-5.3

Could not get the image file path from the storage folder. What am i missing?


Here is the code that saves my image inside /storage/app/public folder

$path = $request->file('question_image')->store('public');

The laravel 5.3 documentation says I have to create a symbolic link from /public/storage to /storage/app/public folder hence I did by using command

php artisan storage:link

At this point I am successful to store my images inside /storage/app/public.

Now what is understood is that I can get those files using

echo asset('storage/file_name.jpeg');

But no luck whatsoever.

Please let me know what I am missing here?


Solution

  • Try this if what you need is the URL of the file: url(Storage::url('public/photo.jpg));

    Otherwise just use Storage::url('public/photo.jpg); to get just the path.