Error while saving attachments (jpegs)

From: Date: Wed, 05 Sep 2001 14:31:32 +0000
Subject: Error while saving attachments (jpegs)
Groups: php.general 
Request: Send a blank email to php-general+get-66048@lists.php.net to get a copy of this message
Hy, i wrote a little cron job which fetches mails from a pop account and saves all contained jpeg attachments to disc. I use the following code: --- snap --- // determine attachment encoding $atty = imap_fetchbody($mbox, $i, $b); switch($att_ency) { case "base64": $decoded_string = imap_base64($atty); break; case "binary": $decoded_string = imap_binary($atty); break; case "other": $decoded_string = $atty; break; } // save it to disc echo $upload_folder.$att_name; $fp = fopen ($upload_folder.$att_name , "w+"); fwrite ($fp, $decoded_string, $atty_size); fclose ($fp); --- snap --- After saving there is a difference in filesize and the image is unusable. Original image size is 758.204 bytes and after saving the attachment to disc its 759.885 bytes. What am i doing wrong here? Greetings from Germany, Daniel

« previous php.general (#66048) next »