Bug #9899 Updated: POST Upload corrupted with Content-type string
| From: | sander@php.net | Date: | Sun, 16 Jun 2002 12:20:54 +0000 |
| Subject: | Bug #9899 Updated: POST Upload corrupted with Content-type string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-10582@lists.php.net to get a copy of this message | ||
ID: 9899
Updated by: sander@php.net
Reported By: tkircht@ipodion.at
-Status: Open
+Status: Bogus
Bug Type: Misbehaving function
Operating System: RedHat/Linux 2.2.16-22
PHP Version: 3.0.17
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 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:
------------------------------------------------------------------------
[2001-03-21 09:32:43] tkircht@ipodion.at
I am using PHP 3.0.18-1.6 on a RedHat system.I am using the following
script to upload files to the server:
[...]
<FORM ENCTYPE="multipart/form-data" ACTION="process.php3" METHOD=POST>
<TABLE WIDTH="75%" BORDER="0">
<TR>
<TD>
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE"
VALUE="5000000">
Name: </TD>
<TD>
<INPUT TYPE="Text" NAME=username SIZE="50">
</TD>
</TR>
<TR>
[...]
==============================================
And this for copying the file to the harddisk:
==============================================
<TD>
<INPUT NAME="userfile" TYPE="file" SIZE="50">
</TD><?
printf ("Name: %s <br>\n",$username);
printf ("FileName: %s <br>\n",$userfile_name);
printf ("FileSize: %s Bytes<br>\n",$userfile_size);
printf ("FileType: %s <br>\n",$userfile_type);
if ( $userfile_size == 0 )
{
printf ("<p><strong>Achtung! Datei ist größer als 5MB -
Upload verweigert</strong></p>");
};
$category=trim($category);
$username=trim($username);
printf ("TmpFileName: %s <br>\n",$userfile);
printf ("Category: %s <br>\n",$category);
$ext=substr($userfile_name,-3,3);
$newfilename=sprintf("%s/%s.%s",$category,$username,$ext);
if ( ! file_exists($category)){
umask(0);
mkdir($category,04770);
}
if (copy($userfile,$newfilename))
{
chmod($newfilename,0775);
printf("<p><strong>%s wurde erfolgreich empfangen und als <a
href=%s>%s</a>
abgelegt!</strong></p>",$userfile_name,$category,$newfilename);
}
else
{
printf("<p><strong>%s konnte nicht als %s-%s abgelegt
werden</strong></p>",$userfile_name,$category,$newfilename);
};
?>
</TR>
</TABLE>
<br>
<INPUT TYPE="submit" VALUE="Abschicken">
</FORM>
The resulting files contain
[root@coimbra Studenten]# head -2 Technische_Physik/me.wav
Content-Type: audio/wav
[root@coimbra Studenten]#
as the first two lines, making them unusable for binary types.
the $userfile_type variable is empty.
This used to work fine with PHP 3.0.14.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=9899&edit=1