My code has one input tag and send it to my php file by using jquery FormData() now i want add another input tag and send more data. jquery it's:
var files = document.getElementById('data-file').files;
var data = new FormData();
$.each(files, function (keys, values) {
data.append(keys, values);
});
$.ajax({
url: 'upload.php',
type: 'POST',
data: data,
cache: false,
processData: false,
contentType: false,
});
and html code is:
<input style="display:none;" type="file" name="data-file" id="data-file" onchange="image_preview(this)" multiple="multiple" />
i want change html to this and send input data to php file by using jquery FormData():
<input style="display:none;" type="file" name="data-file" id="data-file" onchange="image_preview(this)" multiple="multiple" />
<input type="hidden" name="imgpath" id="imgpath" value="<?php echo $imgpath; ?>" />
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>" />