From:             [EMAIL PROTECTED]
Operating system: Linux 2.2.16-22 (RedHat 7.0)
PHP version:      4.0.6
PHP Bug Type:     HTTP related
Bug description:  File uploads: some filetypes work, some don't

I have a problem with file uploads on my PHP configuration. Some filetypes
get uploaded (e.g. BMP, GIF, TXT), while others don't get uploaded (for
example: MSWORD, PDF, EXCEL).

I use the following testfiles:

  <title>Administration - upload new files</title>
<h1>Upload new news files</h1>
<form enctype="multipart/form-data"
action="upload.php" method="post">
  <input type="hidden" name="MAX_FILE_SIZE"
  Upload this file: <input name="userfile"
  <input type="submit" value="Send File">

<h1>Uploading file...</h1>
        echo "file: " .   $userfile . "<BR>\n";
        echo "name: " . $userfile_name . "<BR>\n";
        echo "type: " . $userfile_type . "<BR>\n";
        echo "size: ". $userfile_size ."<P>\n";

if(is_uploaded_file ($userfile))

  $upfile = "/home/projectweb/files/". $userfile_name;

  if ( !copy($userfile, $upfile)) 
    echo "Problem: Could not move file into directory"; 

  echo "File uploaded successfully<br><br>"; 
  $fp = fopen($upfile, "r");
  $contents = fread ($fp, filesize ($upfile));
  fclose ($fp);
  $contents = strip_tags($contents);
  $fp = fopen($upfile, "w");
  fwrite($fp, $contents);

  echo "Preview of uploaded file
  echo $contents;
  echo "<br><hr>";
        echo "There is no file uploaded!";


Result with a BMP file:

file: /tmp/files/phpNGn0H0
naam: at.BMP
type: image/bmp
size: 230
File uploaded successfully

Preview of uploaded file contents:

Result with a Microsoft Word file:

file: none
naam: Doc1.doc
type: application/msword
size: 0

There is no file uploaded! 

I'm puzzeled. Any ideas?

PHP Development Mailing List <>
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