url - Download link not working on server -
i trying add download link file on page, file can either microsoft word document, pdf file, or zip file or other kind of document, have path file stored in database, issue works on localhost on server get: notfoundhttpexception
this how link generated:
<a href="{{ url::to($row->file_url) }}" class="widget-control-right"><span class="fa fa-download"></span></a>
this how file url looks like:
'uploads/data/library/g7tkxmdk7bab12cn//guide.pdf'
in problem, try use helper function called link_to_asset
.
{{ link_to_asset($row->file_url, "download", array("class" => "widget-control-right")) }}
but better approach here :
<a href="{{ route('file.download', $row->id) }}" class="widget-control-right"><span class="fa fa-download"></span></a>
in route.php
route::get("file/download/{id}", array("as" => "file.download", function ($id) { $row = model::find($id); return response::download($row->file_url); }));
hope useful you.
Comments
Post a Comment