|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-02-12 12:58 UTC] jsebestik at seznam dot cz
//When some binary data are send to this script it cause netscape //unstable because PHP engine read STDIN incorrectly. //I have try to read this data with script in perl an it was successful. //I append apache logs that this incorrect reading of input causes. //x.y.x.z - - [12/Feb/2002:17:28:31 +0100] "POST /IR/Edit/index.php //HTTP/1.0" 200 431 "/IR/Edit/index.php" "Mozilla/4.77 [en] (X11; U; //Linux 2.4.2-2 i686)" //x.y.x.z - - [12/Feb/2002:17:28:31 +0100] "<9D>?Y??+k?<9C><9A>YŦ|]z/?;? //<85>????$?#]?gbu\??e??<87>^B" 200 5364 "-" "-" //first log is ok //but second is proof of this uncorrect STDIN reading //it not depend if function //move_uploaded_file($HTTP_POST_FILES['userfile'],"/place/to/put/uploaded///file"); //or //copy($HTTP_POST_FILES['userfile']['tmp_name'],"/place/to/put/uploaded/////file"); //are used. //This error don't occure if I try to upload file of text/plain. //But have been occuring ever when I try to read i.e. image/gif <TABLE bgcolor=#ffffff> <FORM ENCTYPE="multipart/form-data" METHOD=POST ACTION="<?PHP echo "http://$SERVER_NAME$SCRIPT_NAME"; // echo "http://$SERVER_NAME/cgi-bin/UpLoader"; ?>"> <TR><TD></TD><TD></TD></TR> <TR><TD>Sample name:</TD><TD><INPUT NAME="Sample" TYPE=TEXT></TD></TR> <TR><TD valign=top>Notes:</TD><TD><TEXTAREA NAME="SpNotes" ROWS=5 COLS=50></TEXT AREA></TD></TR> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000"> <TR><TD>Send this file: </TD><TD><INPUT NAME="userfile" TYPE="file"></TD></TR> <TR><TD><INPUT TYPE="submit" VALUE="Send File"></TD><TD><INPUT TYPE="reset"></TD ></TR> </FORM> </TABLE> <?PHP $Sample = preg_replace("/[^a-zA-Z0-9]/","",$Sample); if ($Sample != "") { if (move_uploaded_file($HTTP_POST_FILES['userfile'], $IRDirectory . $Sample . ".ir" )) { if ($SpNotes != "") { $fp = fopen($IRDirectory . $Sample . ".txt","w+"); fwrite($fp, $SpNotes); fclose($fp); } } else { echo "File not found !!!\n"; } } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 01:00:01 2025 UTC |
Well, I have two messages. First is a well one and second is a bit but. I try php-4.2.1RC2. It reads STDIN correctly. It means that no corrupted logs appear. But function move_uploaded_file doesn't work properly. On the other hand it could be substitued with these one or two lines: $fltmp = $HTTP_POST_FILES['userfile']['tmp_name']; if (file_exists($fltmp)) { rename($fltmp, $IRDirectory . $Sample . ".ir" ); } Such substitution works very well.