I've a form to upload a file and an input.
<form id="form">
<input type="text" id="name">
<input type="file" id="file">
</form>
This is what I'm using to send the file in Ajax:
$('#form').submit(function(e){
e.preventDefault();
var file_data = $('#file').prop('files')[0];
var form_data = new FormData();
form_data.append('file', file_data);
$.ajax({
type : 'POST',
data: form_data,
url: 'upload.php',
dataType: 'text',
cache: false,
contentType: false,
processData: false,
...
But I dont get the input value.
What I'm missing here please ?
Thanks.
append()for the text input key and value