view raw
rakibtg rakibtg - 5 months ago 39
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?


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