From:             marcus dot stolzenberg at kgrz-kassel dot de
Operating system: SLES 8.0 zSeries s390 IBM
PHP version:      4.3.9RC3
PHP Bug Type:     *General Issues
Bug description:  Error with file upload

Description:
------------
Hello,

First the 'error' is also in 4.3.9rc1 with 4.3.6 everything is fine.

If I am going to upload a file using php which is not txt encoded the file
size of the transfered file is more then doubble and the file stored on the
server is corrupted.

Reproduce code:
---------------
1. HTML Part:

<form enctype="multipart/form-data" action="upload.php" method="post"> 
<input type="file" name="file"><br> 
<input type="submit" value="upload"> 
</form>

2. PHP Part:

$tempname = $_FILES['file']['tmp_name'];
$name = $_FILES['file']['name']; 
$type = $_FILES['file']['type'];
$size = $_FILES['file']['size'];
...
print_r($_FILES);
echo $size;
   copy("$tempname", "/upload/$name");
    
...


Expected result:
----------------
Output useing 4.3.6

Array ( [file] => Array ( [name] => daemon347.exe [type] =>
application/octet-stream [tmp_name] => /uploadkds/phpJGle3P [error] => 0
[size] => 504320 ) ) Array ( ) 

504320



504320 = filesize of desination file on the server = original file size


Actual result:
--------------
Output 4.3.9rc1 and 4.3.9rc3


Array ( [file] => Array ( [name] => daemon347.exe [type] =>
application/octet-stream [tmp_name] => /uploadkds/phplvCHls [error] => 0
[size] => 1004032 ) ) Array ( ) 

1004032 



1004032 = filesize of desination file on the server =! original size


-- 
Edit bug report at http://bugs.php.net/?id=30093&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30093&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30093&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30093&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30093&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30093&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30093&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30093&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30093&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30093&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30093&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30093&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30093&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30093&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30093&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30093&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30093&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30093&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30093&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30093&r=mysqlcfg

Reply via email to