Reputation: 3321
I have a file stored in public/files/sample.pdf
. When I want to download the file using <a href="/public/files/sample.pdf">Download</a>
. It says not found. What will be the correct path. Thank you.
Upvotes: 1
Views: 267
Reputation: 93
If you're really looking for a download response when clicking the link, you should have the URL link to a controller method.
<a href="{{ url('route/to/method') }}">
Now in the controller method
return response()->download(public_path('files/sample.pdf'));
Upvotes: 1
Reputation: 279
You should apply url function instead of paste the directory directly.
<a href="{{url('/files/sample.pdf'}}">Download</a>
Upvotes: 2
Reputation: 676
/files/sample.pdf
You can always use
href="{{asset('files/sample.pdf')}}"
It will be easier
Upvotes: 2