Thursday, 12 September 2013

Corrupted File After File Upload - file size is different

Corrupted File After File Upload - file size is different

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. The file types can be any file types, and the file size
of the uploaded file is always larger than original size. I just 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 extra text to the destination file. I am not sure what
is going on.
I'm not sure if I need to configure something in php.ini or httpd.conf
with this error. Any help would be appreciated. Mary
Below is the code that I tried to test: 0) { echo "Error: " .
$_FILES["file"]["error"] . "
"; } else { echo "Upload: " . $_FILES["file"]["name"] . "
"; echo "Type: " . $_FILES["file"]["type"] . "
"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB
"; // echo "Stored in: " . $_FILES["file"]["tmp_name"]; if
(file_exists("/tmp/wangtest/" . $_FILES["file"]["name"])) { echo
$_FILES["file"]["name"] . " already exists. "; } else {
move_uploaded_file($_FILES["file"]["tmp_name"], "/tmp/wangtest/" .
$_FILES["file"]["name"]); echo "Stored in: " . "/tmp/wangtest/" .
$_FILES["file"]["name"]; } } ?> Filename:

No comments:

Post a Comment