How to access uploaded files?

Posted 6 months ago by malhayek

I am trying to allow my users to upload files.

I am using the following code to save the uplaoded file

$file->store('uploads', config('filesystems.default'))

The files are getting uploaded to storage/app/uploads as expected.

But I am unable to access the uploaded files.

In my views I am using the following to show the URL for the attachment

{{ asset('storage/uploads/d4PH5XJ1wU165nN5EQXzDcxBCvgmAn5p1uRGIrCJ.txt') }}

the above code returns the following

I ran the php artisan storage:link command which created the symbolic link. However, that link returns the following error

NotFoundHttpException in RouteCollection.php line 179:

How can I correctly expose the uploaded file to the public?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.