Upload problem - final size is different

From: Date: Tue, 08 May 2007 16:30:00 +0000
Subject: Upload problem - final size is different
Groups: php.general 
Request: Send a blank email to php-general+get-254554@lists.php.net to get a copy of this message
Hi, I have a form to upload file on my web server, so user can upload their images. The upload work. The user file is uploaded to my destination folder (page5/) but the file is unreadable and the file size is smaller than the original file size. I run Apache with PHP 4.1.2. Thank you, Eric. Here is the form code: <form enctype="multipart/form-data" action="fileupload_bd.php" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Une image<br/><input type="file" name="uneimage" /> <br/><br/>Du texte: <input type="text" name="untexte" /> <br/><br/><input type="submit" /> </form> Here is my PHP upload code: <?php echo $_POST['untexte'] . "<br/><br/>"; $tmp_name = $_FILES['uneimage']['tmp_name']; $type = $_FILES['uneimage']['type']; $name = $_FILES['uneimage']['name']; $size = $_FILES['uneimage']['size']; echo $tmp_name . "<br/>" . $type . "<br/>" . $name . "<br/>"; $target_path = "page5/"; $target_path = $target_path . basename( $_FILES['uneimage']['name']); echo $target_path; if(move_uploaded_file($_FILES['uneimage']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uneimage']['name']).
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
} ?>

« previous php.general (#254554) next »