PHP 4.0 Bug #6314 Updated: unable to retrieve files on uploading with their full size.
| From: | sniper@php.net | Date: | Wed, 08 Nov 2000 23:49:51 +0000 |
| Subject: | PHP 4.0 Bug #6314 Updated: unable to retrieve files on uploading with their full size. | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-37474@lists.php.net to get a copy of this message | ||
ID: 6314
Updated by: sniper
Reported By: dirk@bartkowiak.de
Status: Feedback
Bug Type: IIS related
Assigned To:
Comments:
Does this still happen when using PHP4.0.3pl1 ??
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-08-23 11:36:12] dirk@bartkowiak.de
<html>
<head>
<title>Upload files here:</title>
</head>
<body>
<FORM ENCTYPE="multipart/form-data" ACTION="<?echo $PHP_SELF ?>"
METHOD=POST>
Send this file: <br>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<INPUT NAME="userfile" TYPE="file">
<br><INPUT TYPE="submit" name="upload" VALUE="Send
File">
</FORM>
<?
if(isset($userfile))
{
if (($userfile_type == "image/gif" ) or ($userfile_type == "image/jpeg") or
($userfile_type == "image/jpg") or ($userfile_type == "image/pjpeg"))
{
$hostname = "10.56.33.133"; // host
$username = "root"; // user
$password = "root"; // password
$usertable = "bilder"; // tablename
$dbName = "pix"; // dbname
//connect to database
$db = MYSQL_CONNECT($hostname, $username, $password) OR DIE( "Unable to
connect to database");
mysql_select_db( $dbName, $db) or die( "Unable to select database");
$fp = fopen($userfile, "r");
$imagedata = addslashes(fread( $fp, filesize($userfile)));
fclose($fp);
echo filesize($userfile);
echo "||";
echo strlen($imagedata);
$insert = "insert into $usertable(data, mime) values('$imagedata',
'$userfile_type')";
$result = MYSQL_QUERY($insert, $db);
$idnum = mysql_insert_id();
echo "<img src="get.php?id=$idnum"><br>";
mysql_close($db);
}
}
?>
<!--
Problem is reproduceable. PHP isn't able to upload files.
You get a filesize of xxx bytes but fread didn't appears to read the whole file.
Also the script works on apache and php 4.0.1 pl2 fine.
!-->
</body>
</html>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6314