Ajax request to php with empty POST data
Hi,
I'm trying send and http request with some data and file to upload to an php server, but server receive empty data or is unable to parse it. I suspect that there is something that I can't understard with multipart data requests but I have no idea what can it be. The inspector reveals that post data is sending ok, but in server has empty $_POST or $_REQUEST. Is the Ajax request well configured to upload data and files?
Thanks in advance.
html
===========
<form id="
idform" method="post" enctype="multipart/form-data" name="myform" action="process.php">
<input id='idCamera' name='inputCamera' type='file' accept='image/*' capture='camera'>
</form>
JavaScript request
==================
var data = new FormData(document.getElementById("idform"));
var url = $("#idform").attr("action");
$.ajax({
type: "POST",
url: url,
data: data,
enctype: 'multipart/form-data',
async: false,
processData: false, // tell jQuery not to process the data
contentType: false, // tell jQuery not to set contentType
success: function(response)
{
alert('Done');
},
beforeSend: function()
{
}
});
Inspector data report
==================
-----------------------------28121104010347
Content-Disposition: form-data; name="editRoom"
0110
-----------------------------28121104010347
Content-Disposition: form-data; name="zone"
183
-----------------------------28121104010347
Content-Disposition: form-data; name="action"
uploadPhoto
-----------------------------28121104010347--
Received data within php server
==========================
var_dump($_POST) : array(0) {}