G
G
Grigory Vasilkov2018-01-30 16:43:07
PHP
Grigory Vasilkov, 2018-01-30 16:43:07

How to send gzip xml file via PHP?

Greetings.
Explain why a gzip file sent with

header('Content-Description: File Transfer');
  header('Content-Type: application/octet-stream');
  header('Content-Disposition: attachment; filename=' . basename($fp_gz));
  header('Expires: 0');
  header('Cache-Control: must-revalidate');
  header('Pragma: public');
  header('Content-Length: ' . filesize($fp_gz));
  ob_clean();
  flush();
  readfile($fp_gz);

If you open a file in a folder - everything works. It is worth trying to send it through the browser - an archive error.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question