rakibtg rakibtg - 1 year ago 107
PHP Question

Laravel 5.3 storage cant find uploaded file

I am using laravel Filesystem to store images, the image will be uploaded inside the default storage, example:


I didnt change the
and here is my controller method to upload an image,

public function storeImage( Request $request ) {
$image = $request->file( 'image' )->store( 'images/posts/'.Auth::user()->id );
echo Storage::url( $image ); // <- print the url of the uploaded image

This would print the image url like this,


But the image file is not accessable from the browser!
I dont want to use php to dynamically fetch the images, i just wanted to make them publicly accessable over http. How to display the image?

Answer Source

you just have to make a change in config\filesystems.php form

'default' => local,

to 'default' => public,

then in console run php artisan storage:link

then try the above code and it will work

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download