Download dialog not works - php 'headers'

Hi,

I have probelm with download a file throught 'header' after redirect my site HTPP to HTTPS.

Plugin Donwload 'plugins/download/download.php' case 'dl'
I tested this code for opening download dialog and still not work :-(

$file_name = "robots.txt";

// Quick check to verify that the file exists
if (!file_exists($file_name)) die("File not found");

// Force the download
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file_name));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file_name));
ob_clean();
flush();
readfile($file_name);

Any idea please?

Comments

Sign In or Register to comment.