Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

M.Yanis's avatar

Download file from enpoint API

I would like to download a file directly from the api function (backend). I currently store my file on storage public then I return response()->download($myFilePath) but it doesn't trigger the download it returns a response in my console like a binary file.

0 likes
3 replies
MohamedTammam's avatar

It is better not to use AJAX for downloading a file, just use normal URL for it.

Please or to participate in this conversation.