ale1981 Posted June 12, 2007 Share Posted June 12, 2007 Hi guys, I am pulling my hair out here, for some reason this code is ALWAYS giving me the file not found error, even though i have checked the file destination manually and it exists! This is the part of the script giving me a headache; if (!isset($dest_email) || !$dest_email) { $xls->send($filename); } else { if (file_exists($dir . $filename)) { //Connect to localhost on port 25 $swift =& new Swift(new Swift_Connection_SMTP("localhost")); $message =& new Swift_Message("Non Stock Sales Report"); $message->attach(new Swift_Message_Part("The file you requested has been attached to this email.")); //Use the Swift_File class $message->attach(new Swift_Message_Attachment( new Swift_File($dir . $filename), "$filename", "application/xls")); if ($swift->send($message, "$dest_email", "webserver@#####")) { echo 'Your email sent succesfully.'; } else { echo 'ERROR - Your email was unsuccessful.'; } $swift->disconnect(); sleep(5); unlink($dir . $filename); } else { echo 'ERROR - '. $filename .' was not found, try again later.'; } } Any help would be appreciated. Thanks. Link to comment https://forums.phpfreaks.com/topic/55227-solved-file_exists-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.