I have a form on example.com/contact-us.php
that looks like this (simplified):
In my own case, i was using serialize()
on the form, Hence the files were not being sent to php. If you are using jquery, use FormData()
. For example
Using jquery,
$('#form').submit(function (e) {
e.preventDefault();
var formData = new FormData(this); // grab all form contents including files
//you can then use formData and pass to ajax
});