I tried to download an existing odt file using the below PHP code.
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
header('Content-Description: File Transfer');
header("Pragma: public"); // required
header("Expires: 0"); // no cache
header("Cache-Control: must-revalidate");
header("Cache-Control: private");
header("Content-Type: application/vnd.oasis.opendocument.text");
header("Content-Disposition: inline; filename=\"".basename($filename)."\";");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
exit();
When I executed, an odt file is downloaded, but the content is not as the original odt file content. That downloaded file contains something like serialized or non-readable text with multiple pages. Could anyone help me to get the actual file to download please?