File Upload Error - File size increased after file uploaded
Posted: Wed Feb 27, 2008 2:09 pm
Hey all,
On one of my webserver, I got this really odd problem with file upload (csv file). Basically after the file got uploaded to the server, the file size increases. I see more records than the original file and these recs are duplicate records.
PHP Version 5.0.4
Apache/2.0.52 (Unix)
The same script and input file is working properly on another server:
PHP Version 5.0.4
Apache/2.0.58 (Unix)
I'm not sure what's happening here. Any input is appreciated.
upload.html
uploader.php
On one of my webserver, I got this really odd problem with file upload (csv file). Basically after the file got uploaded to the server, the file size increases. I see more records than the original file and these recs are duplicate records.
PHP Version 5.0.4
Apache/2.0.52 (Unix)
The same script and input file is working properly on another server:
PHP Version 5.0.4
Apache/2.0.58 (Unix)
I'm not sure what's happening here. Any input is appreciated.
upload.html
Code: Select all
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
Code: Select all
<?php
$target_path = "/tmp/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
echo "File type: " . $_FILES['uploadedfile']['type'] . "</br>";
echo "File name: " . $_FILES['uploadedfile']['name'] . "</br>";
echo "File size: " . $_FILES['uploadedfile']['size'] . "</br>";
echo "Return Code: " . $_FILES['uploadedfile']['error'] . "</br>";
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>