As the title suggests, despite setting the content-disposition header to attachment, and seeing the binary data successfully returned from the server, it simply will not trigger the download.
The files are stored as a BLOB in a mysql database and my browser is Chrome 55.
My code:
$doc = $database->getDocument($docId);
$filename = $doc['name'];
$filetype = $doc['type'];
$filecontent = $doc['content'];
header('Content-Type: ' . $filetype);
header('Content-length: ' . strlen($filecontent));
header('Content-disposition: attachment; filename=' . '"' . $filename . '"');
echo $filecontent;
I've tried changing the Content-type to 'application/octet-stream' as well as changing the Content-disposition from 'attachment' to 'download' with no luck.
I have no idea what the problem is and I would appreciate it if anyone could shed some light on the issue.