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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.