php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6314 unable to retrieve files on uploading with their full size.
Submitted: 2000-08-23 11:36 UTC Modified: 2000-12-07 11:33 UTC
From: dirk at bartkowiak dot de Assigned:
Status: Closed Package: IIS related
PHP Version: 4.0.1pl2 OS: Win 2000 IIS 5.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dirk at bartkowiak dot de
New email:
PHP Version: OS:

 

 [2000-08-23 11:36 UTC] dirk at bartkowiak dot 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>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-08 18:49 UTC] sniper@php.net
Does this still happen when using PHP4.0.3pl1 ??

--Jani
 [2000-12-07 11:33 UTC] sniper@php.net
No feedback.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 04:01:29 2025 UTC