> Is there any way not to write those line into the uploaded file?
It's a bug in 4.0.4pl1 on (AFAIK) RH7 and Apache. Will be fixed in 4.0.5.
You can't avoid them, but use something like the following to strip them
out:
/* void fix_broken_header(reference file)
* Incorporates fix for problem with Apache & PHP 4.0.4p1
* on Red Hat 7, where the content-type header is appended to the image
data,
* corrupting it. See www.php.net/bugs.php?id=9298 - it took me a *long*
time to
* figure out what the fsck was going on!
*
* 02/04/2001 - oddly enough it doesn't happen w/NS4.74 on Win or Linux only
IE5 & NS6
*/
function fix_broken_header(&$image) {
$new_image = "$image.new";
// Open the file for the copy
$infile=fopen($image,"rb");
$outfile=fopen($new_image,"w");
// test for broken header
$header=fgets($infile,255);
if (eregi("content-type:", $header)) {
$header=fgets($infile,255); // ditch next line
}
else {
return; // do nothing
}
// Loop through the remaining file
while(!feof($infile)) {
$temp = fread($infile,128);
fwrite($outfile,$temp,strlen($temp));
}
fclose($outfile);
fclose($infile);
unlink($image);
$image = $new_image;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]