I'm doing a test to download the file
The script I have so far:
<a href="{{ route('export.download_response') }}">
<button>Export(Response)</button>
</a>
class ExportController extends Controller
{
public function download_response(){
$filePath = Storage::path('public/test.png');
$fileName = 'test.png';
$mimeType = Storage::mimeType($filePath);
$headers = [['Content-Type' => $mimeType]];
return response()->download($filePath, $fileName, $headers);
}
}
Route::get('/export/download_response', [ExportController::class, 'download_response'])->name('export.download_response');
I have already put the file test.png in the path storage/app/public/test.png
But there are still error messages: FileNotFoundException File not found at path: var/www/html/lav_8_filedownload/storage/app/public/test.png
Any help would be greatly appreciated, thanks