From:             [EMAIL PROTECTED]
Operating system: RedHat/Linux 2.2.16-22
PHP version:      3.0.17
PHP Bug Type:     Misbehaving function
Bug description:  POST Upload corrupted with Content-type string

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&ouml;&szlig;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.





-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to