Hi I have the following code $fp=fopen($agentcode.date("m-d-Y-g-i-s").'CyberTrac.ctr', "w"); fwrite($fp,"$agentcode etc etc"); $fc = fopen($fp, 'rb'); $attachment = fread($fc , filesize($filename)); fclose($fc); $mail = new html_mime_mail('X-Mailer: Html Mime Mail Class'); $mail->add_attachment($attachment, $agentcode.date("m-d-Y-g-i-s").'CyberTrac.ctr', 'application/octet-stream'); The file is successfuly created. When it is attatched to the email however the size is written as 0 bytes, the filename is the same though. If I check the file on the server side it s perfectly ok, any ideas? TIA Wade