File Download Issue in Laravel 11 with Inertia and Vue
I'm using Laravel 11 with Inertia and Vue. In one of my controllers, I have a method to download files:
public function downloadFile($id){
$file = File::find($id);
return Storage::download($file['path']);
}
Laravel doesn't give any errors, but when I call this method, it redirects me to the page I was on, and the file doesn't get downloaded - it's as if nothing happened.
I've also tried using response(Storage::download($file['path'])), but then a popup tells me:
HTTP/1.0 200 OK
Cache-Control: no-cache, private
Content-Disposition: attachment; filename=file1.PNG
Content-Length: 2332
Content-Type: image/png
What could be causing this issue, and how can I fix it?