|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9899 POST Upload corrupted with Content-type string
Submitted: 2001-03-21 09:32 UTC Modified: 2002-06-16 08:20 UTC
From: tkircht at ipodion dot at Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.17 OS: RedHat/Linux 2.2.16-22
Private report: No CVE-ID: None
 [2001-03-21 09:32 UTC] tkircht at ipodion dot 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>
        <INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="5000000">
        Name: </TD>
        <INPUT TYPE="Text" NAME=username SIZE="50">

And this for copying the file to the harddisk:
        <INPUT NAME="userfile" TYPE="file" SIZE="50">
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&ouml;&szlig;er als 5MB - Upload verweigert</strong></p>");
printf ("TmpFileName: %s <br>\n",$userfile);
printf ("Category: %s <br>\n",$category);
if ( ! file_exists($category)){
if (copy($userfile,$newfilename))
        printf("<p><strong>%s wurde erfolgreich empfangen und als <a href=%s>%s</a> abgelegt!</strong></p>",$userfile_name,$category,$newfilename);
        printf("<p><strong>%s konnte nicht als %s-%s abgelegt werden</strong></p>",$userfile_name,$category,$newfilename);
  <INPUT TYPE="submit" VALUE="Abschicken">

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 08:20 UTC]
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

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.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 01 03:01:22 2020 UTC