Bug #15526 Updated: Uploading of binary file

From: Date: Sat, 15 Jun 2002 13:49:26 +0000
Subject: Bug #15526 Updated: Uploading of binary file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10499@lists.php.net to get a copy of this message
ID: 15526 Updated by: derick@php.net Reported By: jsebestik@seznam.cz -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: linux PHP Version: 4.1.1 New Comment: Thank you for taking the time to report a problem with PHP. Unfortunately your version of PHP is too old -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Previous Comments: ------------------------------------------------------------------------ [2002-05-09 13:16:20] jsebestik@seznam.cz 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. ------------------------------------------------------------------------ [2002-05-06 00:00:03] php-bugs@lists.php.net No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open". ------------------------------------------------------------------------ [2002-04-03 02:52:50] yohgaki@php.net Could you try 4.2.0RC1? Please visit http://qa.php.net/ for 4.2.0RC1. ------------------------------------------------------------------------ [2002-02-12 12:58:22] jsebestik@seznam.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"; } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15526&edit=1

« previous php.bugs (#10499) next »