I'm using this code to prompt for a file download on Symfony 2.7. It's working on Windows/Mac/iPhone, but not on Android:
if (!file_exists($path)) {
throw $this->createNotFoundException('File not found.');
}
$response = new BinaryFileResponse($path);
$response->trustXSendfileTypeHeader();
$response->setContentDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
$name,
iconv('UTF-8', 'ASCII//TRANSLIT', $name)
);
When tapping the link, the download starts but then the error appears: Filename.pdf is of invalid format. If I press the link and select "Save Link", then the PDF si downloaded correctly and I can open it.
Does anyone know how to fix the download on Android? (tested using version 5).
Thank you