I'm trying to send a file input on my form via AJAX and PHPMailer however, readying absolutely everything online and trying examples I'm not sure what the best method is.. Surely this can be done in a few lines of code? I can't find a good enough guide / demo anywhere online or on the stackoverflow site to go through
Would be GREAT if someone could show a way for multiple file uploads from one input field too?
File input:
<input type="file" name="attachments" id="attachments"/>
JS Formdata:
attachments : $('#attachments').prop('files')
AJAX Post:
$.ajax({ type: "POST", url: 'sendmail.php', data: form_data, async: true, success: function(value) { }, error: function(value) { } });
PHP Side?
$attachments = $_FILES['attachments'];