I would be grateful if you tell me how to send a photo to an email c <input type="file"> , I only have the name of the photo to come not the image itself, how can I get an image? html:
<input type="file" id="fileOne"> js:
$("#formModel").submit(function() { $.ajax({ url: "send.php", method: "POST", data: { name: $("#formModel input[name='name']").val(), photo: $("#formModel #fileOne").val() } }); return false; }); php:
<?php $ToEmail = 'myemail.com'; $EmailSubject = 'Анкета'; $mailheader = "From: ".$_POST["email"]."\r\n"; $MESSAGE_BODY .= "Имя: ".$_POST["name"]."\n"; $MESSAGE_BODY .= "Фото 1: ".$_FILES["photo"]."\n"; mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); ?>