I\'m trying to create a script that will send an image uploaded from an iphone app I\'m developing to me in an email.
I\'ve been able to get the script to send me an
While there are canned functions for this, what a fantastic exercise for a junior programmer!
Very well written mti2935. It would do folks good to actually read and not just cut-and-paste. If you're sending email with php, you should understand these fundamental concepts.
Probably some oversights from masking your real code:
Line 23 should be:
$data = fread($file,filesize($filename));
That is, $fname
should be $filename
.
Line 26 should be:
$message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"".$fname."\"\n" .
Neither $x
nor $files[$x]
are defined.
@Thomas Spade: I'd like to remind that you should always sanitize input (email address).