I need download a file from a directory in Symfony. The problem is, I need download this file when I am authenticated.
For that, I create a endpoint (GET method) with an ID (the id file), and I am doing the call from a React app passing in the Headers an authorization bearer.
The problem is, the file is not download directly, but if I enter in DevTools from Chrome, I see that in the response exists the file, but it is not downloaded.
This is the PHP code:
$file = new File($fullPath);
return $this->file($file);
How could I download the file?