I have made a syslink in the public folder
Aug 6, 2019
14
Level 1
Can't download File
Hi, I am battling to download a file in my storage directory
Directory is: storage/app/upload/client/
after the client/ the stored client_id - > user->name is used and then the file name. I currently have this as the download button, but it isn't rendering anything.
<a href="{{storage_path()}}/upload/client/{{$teamform->forms->users->name}}/{{$teamform->forms->upload}}" class="btn btn-outline-primary float-right" target="_blank"><i class="fa fa-download"></i> Download </a>
Level 2
You can do something like that:
web.php
Route::get('team-form/{user}/{file}', 'TeamFormController@downloadClientFile')->name('clientDownload');
TeamFormController
public function downloadClientFile($user, $file) {
return response()->download(storage_path('app/upload/client/' . $user . '/' . $file));
}
view
<a href="{{ route('clientDownload', ['user' => $teamform->forms->users->name, 'file' => $teamform->forms->upload]) }}">Download</a>
1 like
Please or to participate in this conversation.