redfroc
11-29-2007, 04:00 AM
I need to provide download for php file on my site.
I use this script:
session_cache_limiter('none'); //*Use before session_start()
session_start();
$file = 'file.php';
_Download("hiddendir/".$file, $file);
function _Download($f_location,$f_name){
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($f_location));
header('Content-Disposition: attachment; filename=' . basename($f_name));
readfile($f_location);
}
but give me this error: Warning: Cannot modify header information - headers already sent by (output started at ....
then I use force download scripts from http://www.zubrag.com/scripts/ and http://www.gowondesigns.com/?page.getfile
they works well, then i added 'php' => 'application/octet-stream' to the configuration of both script. but it doesn't work.
could somebody help me pls...
thank you.
I use this script:
session_cache_limiter('none'); //*Use before session_start()
session_start();
$file = 'file.php';
_Download("hiddendir/".$file, $file);
function _Download($f_location,$f_name){
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . filesize($f_location));
header('Content-Disposition: attachment; filename=' . basename($f_name));
readfile($f_location);
}
but give me this error: Warning: Cannot modify header information - headers already sent by (output started at ....
then I use force download scripts from http://www.zubrag.com/scripts/ and http://www.gowondesigns.com/?page.getfile
they works well, then i added 'php' => 'application/octet-stream' to the configuration of both script. but it doesn't work.
could somebody help me pls...
thank you.