How to give a file to download?

$content = 'Content of the xml file';

 header('Content-type: text/xml');
 header('Content-Transfer-Encoding: binary');
 header('Expires: 0');
 header('Cache-Control: must-revalidate');
 header('Pragma: public');
 header('Content-Disposition: attachment; filename="' . $filename . '"');
 header('Content-Length:' . $fsize);
 readfile($path);

Modified my old script to return the ppt file. But:
attachment; filename - probably not needed, I don't have a file on disk that would attach it to
Content-Length is the same
And where to put the variable $content?
July 9th 19 at 10:17
1 answer
July 9th 19 at 10:19
Solution
filename - the filename when saving in the save dialog
Content-Length - strlen($content);
readfile($path); change it to echo $content;

Find more questions by tags PHP