Okies,
Im current working on a section that previously has worked ok, (file.php)It involves forcing downloads using headers etc..
The only differences injected today is to store files in
./files/"md5hash of (Casename + Casenumber)"/
as opposed to..
./files/
The code ive been using for the forced downloads is as follows..
$filename = dl_file($f,$casenum);
$filepath = $working_dir."/".md5("case".$casenum)."/".$filename;
echo $filepath;
if (strlen($filepath)!=0) {
$filename = basename($filepath);
if (is_file($filepath)) {
$size = filesize($filename);
header("Content-Type: application/x-ms-download");
header("Content-Type: application/force-download");
header("Content-Length: $size");
if (preg_match("/MSIE 5.5/", $HTTP_USER_AGENT) || stristr($HTTP_USER_AGENT, "MSIE")) {
header("Content-Disposition: filename=$filename");
} else {
header("Content-Disposition: attachment;filename=$filename");
}
header("Content-Transfer-Encoding: binary");
$fh = fopen($filepath, "r");
fpassthru($fh);
$op == '';
}
}
As i said this code was working before hand.. so what now happens is that
txt (and other) files come down with the content of txt file in the middle of a copy of my file.php..
by this i mean..
somefile.txt comes down as ...
header info from file.php
contents of somefile.txt
and then end bits of file.php
pdf,jpg,xls,doc files come down corrupted (i am presuming some of file.php is getting into the copy
Could it be something ive done in php.ini? or am i just over-worked enough to not notice something f***ing stupid
Thanks in advance..
Amos