Jump to content

Attach image to Email


SilentQ-noob-

Recommended Posts

HI,

I use e-mail forms on my site frequently for user feedback, and it works great. However; now I for one of the forms I want users to upload a picture (which will send to my email ) as well. I'm still pretty new to this so I'm not quite sure how to go about it. This is what I have now:

<?
$email = $_POST['email'];
$image = $_FILES['fupload']['tmp'];
$to = "myemail@gmaildotcom";

if($_FILES['fupload']['type'] == "image/jpg" ) {
mail($to, 
 			"Email: $email" ,
			"
			Picture: $image" ); 
}
?>


<form enctype="multi-part/form-data"
action="<? print $_SERVER['PHP_SELF'] ?>" method="post">
    <p>
    Email:<input type="text" value="<? echo $email ?>" />
    <input type="hidden" name="MAX_FILE_SIZE" value="102400"  />
    <input type="file" name="fupload" /><br />
    <input type="submit" value="Send"  />
    </form>

I'm pretty sure what I have to do is save the images temporarily in a folder somewhere on my server, and then send the image from there, or maybe not? Any help would be greatly appreciated! looking forward to feedback,

thanks.

Link to comment
https://forums.phpfreaks.com/topic/71405-attach-image-to-email/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.