I am trying to troubleshoot an issue I am having with downloading a \"zip\" file from a php script. It seems that when I download the file using the following code, the dow
I had same problem So I used this headers and I got my solution.
$filename = ABSPATH.'/wp-content/summary/user_content/'.trim($file);
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Description: File Transfer');
header('Content-Type: text/text');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: max-age=0');
readfile($filename);
exit;