ken.stendfield Posted April 27, 2008 Share Posted April 27, 2008 I need my script to read a local file and then send it to the administrator. The sending part works perfectly, but the fopen function attempts to read the file from the server. Is there anyway to make it read from your local drive? (For example. "D:\db_backup.sq'") ? <?php $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); $to = "[email protected]"; $from = "friend2gmail.com"; $headers = 'From:' . $from . "\r\n" . 'Reply-To: $from' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $filename, $contents, $headers); ?> Link to comment https://forums.phpfreaks.com/topic/103193-read-local-file-and-send-mail/ Share on other sites More sharing options...
dptr1988 Posted April 27, 2008 Share Posted April 27, 2008 You need to upload the file from your computer to the server for the server to be able to mail it. http://us3.php.net/features.file-upload Link to comment https://forums.phpfreaks.com/topic/103193-read-local-file-and-send-mail/#findComment-528580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.