I posted the same question and I have found an answer in the archive. I guess you are using php on RedHat. The problem is (as Richard sugested) extra lines that need to be triped off. NOTE: I am not sure if this is the problem with image files only or this applies to .txt, .doc, etc. this works for me
--------------------------------------- function fix_php_upload_bug($tmp) { $infile=fopen($tmp,"r"); // Open the file for the copy $outfile=fopen("$tmp.new","w"); // create a new temp file $header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't add a Content-type line) //if its more than just a \r\n sequence then if (strlen($header)>2) $header=fgets($infile,255); //get next line also while(!feof($infile)) { // Loop through the remaining file $temp=fread($infile,128); fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file } fclose($outfile); fclose($infile); copy("$tmp.new","$tmp"); //replace the original with our new bug fixed file unlink("$tmp.new"); //and delete the new file return filesize($tmp); //return a true file size copy($tmp, "/home/webdesigning/public_html/demo/".$myfile_name); } -------------------------------------- Hope this helps REgards Ajdin On Tue, 2 Oct 2001, Richard Lynch wrote: > #1 Upgrade PHP. > > #2 Try comparing the files in a text-editor. > > You may be able to strip out the extra stuff at the top as an interim > measure. > > > -- > WARNING [EMAIL PROTECTED] address is an endangered species -- Use > [EMAIL PROTECTED] > Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm > Volunteer a little time: http://chatmusic.com/volunteer.htm > ----- Original Message ----- > From: Boni Ion <[EMAIL PROTECTED]> > Newsgroups: php.general > To: <[EMAIL PROTECTED]> > Sent: Saturday, September 29, 2001 6:35 PM > Subject: image upload problems (diff. file size after upload) > > > > image for upload: admin_logo.gif size: 1665 bytes > > > > image after upload ON SERVER: admin_logo.gif size: 1692 bytes WHY ??? > > and I can't see it in browser!!!!???! > > > > pls help ... > > > > php version:4.04pl1 > > apache server:1.3.12 > > so:red hat 7.0 > > > > this is my code : > > > > /*upload.html */ > > > > <html> > > <head> > > <title>Upload a File</title> > > </head> > > > > <body> > > > > <h1>Upload a File</h1> > > > > <form enctype="multipart/form-data" method="post" > > action="do_upload.php"> > > > > <p><strong>File to Upload:</strong><br> > > <input type="file" name="img1" size="30"></p> > > > > <P><input type="submit" name="submit" value="Upload File"></p> > > > > </form> > > </body> > > > > </html> > > > > > > /* do_upload.php" > > <? > > > > if ($img1_name != "") { > > > > copy("$img1", "/tmp/$img1_name") > > or die("Couldn't copy the file!"); > > > > } else { > > > > die("No input file specified"); > > } > > > > ?> > > > > <html> > > <head> > > <title>Successful File Upload!</title> > > <body> > > > > <h1>Success!</h1> > > > > <P>You sent: <? echo "$img1_name"; ?>, a <? echo "$img1_size"; ?> > > byte file with a mime type of <? echo "$img1_type"; ?>.</p> > > > > </body> > > </html> > > > > > > > > -- > > Boni Ion > > Intersat-Telecom / www.intersat-telecom.ro / > > Constanta, Romania, Europe > > Phone: +40 41 691230 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]