PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 17, 2022

[FIXED] Laravel 5.4 storage file not found

 February 17, 2022     laravel, laravel-5.3, php     No comments   

Issue

I am using laravel 5.4. I upload some document file in storage/app/public/documents folder like

$request->paper_file->store('documents');

and my file uploaded successfully.

in file system default storage is public and public conf is like

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

but when i hit /storage/documents/hQqlgifnVVH8bmrRPVdZ9aFGbhLmcc7g7bHZSX4u.pdf it says not found 404. How to solve this issue.


Solution

By default Laravel puts files in the storage/app/public directory, which is not accessible from the outside web. So you have to create a symbolic link between that directory and your public one:

storage/app/public -> public/storage

You can do that by executing the php artisan storage:link command (docs).



Answered By - Jebediah
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing