it is sending the inputs well, but not the file to php. any ideas why?
$('#submit_c').click(function (e) {
var form = $('#form32_c');
// prevent default action
e.preventDefault();
// send ajax request
$.ajax({
url: '/js-calls/post.php',
type: 'POST',
cache: false,
data: form.serialize(),
success: function(data){
$('#back').hide();
}
});
});
form:
<form id="form32_c" method="post"><br><br>
<div class=titles_c>Title:</div>
<input type="text" class="form_inputs" name="ftitle" placeholder="name" maxlength="50"><br><br>
<div class=titles_c>Cover Image:</div>
<input type="file" name="fileToUpload" class="form_inputs" id="fileToUpload"><br><br>
<input type="submit" id="submit_c" class="button2" value="CREATE">
</form>
php:
if (isset($_FILES['fileToUpload']['tmp_name'])) {
...
}
else{
always here.
}