I'm making module and I have there action to download a file from serwer (action.get_prof_file.php).
Code: Select all
..................
if(ini_get('zlib.output_compression')){
ini_set('zlib.output_compression', 'Off');
}
@ob_clean();
@ob_clean();
if(!file_exists($file_path) || !is_readable($file_path)) die("File can't be readable");
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private',false);
header('Content-Description: File Transfer');
header('Content-Type: application/force-download');
header('Content-Length: '.filesize($file_path));
header('Content-Disposition: attachment; filename="'.$row['oryginal_name'].'"');
readfile($file_path);
exit;
PS. path to downloaded file (in $file_path variable) is correct and file exists and is readable. This part of code is mostly copied from Uploads module and in upload module download works perfect.
PS2 sorry for my poor english