Upload: 0x00 => 0x20

From: Date: Tue, 01 Aug 2000 07:24:06 +0000
Subject: Upload: 0x00 => 0x20
Groups: php.general 
Request: Send a blank email to php-general+get-9371@lists.php.net to get a copy of this message
Hello php people! I encountered the following problem: uploaded files have all 0s (0x00) changed into spaces (0x20). So most of graphics are corrupted. I use the following snippet to check this: <?php if ($Picture_size > 0) { $C = ""; $f = fopen($Picture, "rb") or die ("fopen error."); while (!feof($f)) $C .= fread ($f, 4096); echo "read size=".strlen($C)."<BR>"; echo "file=".bin2hex($C)."<BR>"; fclose ($f); } ?> <FORM name='TestForm' enctype='multipart/form-data' method='POST' action='test2.php'> <TABLE> <TR> <TD align="right">Picture:</TD> <TD><input type='hidden' name='MAX_FILE_SIZE' value=500000> <INPUT type='file' name='Picture'> <INPUT type='submit' name='Submit'></TD> </TR> </TABLE> </FORM> You can find it at http://inteki.sibintek.net/test2.php. When uploading files containing NULLs (e.g. http://inteki.sibintek.net/test.txt -- first byte is a null) you'll see that they're changed into 0x20. Have anyone encountered a similar problem ? What counld be the ways to handle it ? I am using Apache/1.3.12 (Unix) PHP/4.0.1pl2 rus/PL29.4 The interesting fact is that the same test runs correctly under Windows with the same versions of Apache and PHP. Thanks in advance, Alex Vershinin.

« previous php.general (#9371) next »