1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Rep Power

    Corrupted File After File Upload - file size is almost doubled

    I'm running on RHEL 6.2, PHP 4.4.9 and Apache 2.2.15, after the most recent upgrade the file upload logic no longer works. Basically, the file upload seems to be uploaded successfully (no errors returned), but the file is corrupted. After the file reached to certain size, there is some kind of header text is being inserted into the file. I compared the source .txt file to the destination .txt, the destination file includes "Content-Disposition: form-data; name="file"; filename="final.txt"
    Content-Type: text/plain" in the .txt file. Basically, it added some kind of header text and extra text to the destination file. I am not sure what is going on. The size of the file seems to be doubled. Has anyone encountered this problem with PHP 4.4.9?

    I'm not sure if I need to configure something in php.ini or Apache httpd.conf with this error. Any help would be appreciated. Mary

    Below is the code that I tried to test:
    if ($_FILES["file"]["error"] > 0)
    echo "Error: " . $_FILES["file"]["error"] . "<br>";
    echo "Upload: " . $_FILES["file"]["name"] . "<br>";
    echo "Type: " . $_FILES["file"]["type"] . "<br>";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
    // echo "Stored in: " . $_FILES["file"]["tmp_name"];
    if (file_exists("/tmp/wangtest/" . $_FILES["file"]["name"]))
    echo $_FILES["file"]["name"] . " already exists. ";
    "/tmp/wangtest/" . $_FILES["file"]["name"]);
    echo "Stored in: " . "/tmp/wangtest/" . $_FILES["file"]["name"];
    <form action="upload_file.php" method="post"
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">

  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Washington, USA
    Rep Power

IMN logo majestic logo threadwatch logo seochat tools logo