In my basic code with JavaScript and PHP so far I can send an email with test data, the next step in the process is to add an attachment to the email .
Following this, the following doubts have arisen:
1. The first one related to the following code:
HTML
<input type="file" name="myFile" id="myFile" required/>
With this I take the attached file ready to send.
Now in my JavaScript, I have a function that successfully sends an email with test data:
function SendMail(){
var cod="1234"; var subject="hello my friend";
$.post("SendMail.php?cod="+cod+"&subject="+subject+""); // (1)
}
In (1) How do I take the value of that input, which is related to the file to send to be able to send it to my PHP file?
Something like
$.get("SendMail.php?cod="+cod+"&subject="+subject+"&mail="ArchivoRelacionadoConElIDdelInput);
2. When you can send the file correctly, what is the appropriate way to format it to be added to the email to be sent?
Those are my doubts about it, I hope you can give me a hand. Your answers, as always, are welcome.
Thanks for your time.