<?
/*
Hi
I do receive a warning when using this script

Warning: Cannot modify header information - headers already sent by (output started at /dir/to/this/file/download.php:1) in /dir/to/this/www.website.com/download.php on line x

this script work in another site i have done what can be wrong ? how can i let the user click on a link to force the download of the picture i want him to download?
*/
$file = $REQUEST['file'];
$download_dir = $
REQUEST['download_dir'];

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
header( "Content-Length: " . filesize ( $download_dir . $file));
header("Content-Type: application/force-download");
header("Content- Transfer-Encoding: binary");
Header('Content-Type: application/jpeg');

Header("Content-Disposition: attachment; filename=".$file);
readfile("$file");
?>

    Warning: Cannot modify header information - headers already sent by (output started at /dir/to/this/file/download.php:1) in /dir/to/this/www.website.com/download.php on line x

    what line is it on? if you tell us instead of just saying "x" then it would help alot more.

      it happens on every line where the header function is called

      i try using ob_start at the beggining and ob_end_flush at the end but it does not work

        well there was a blank space at the beggining
        now it is working

        best regards

          Write a Reply...