It's in WordPress. I have to submit form with file and get that file. I'm getting the text fields data very well, but unable to catch file :( there is my code below.
HTML
<form method="POST" class="JsFormPro" enctype="multipart/form-data">
<table>
<tr>
<td>
<textarea name="WordText" id="WordText" class="WordText" cols="30" rows="10"></textarea>
</td>
</tr>
<tr>
<td>
<input type="file" id="WordFile" class="WordFile" name="WordFile">
</td>
</tr>
<tr>
<td>
<input type="submit" name="" value="Submit">
</td>
</tr>
</table>
</form>
There is my jQuery and AJAX code
var form = $('.JsFormPro');
form.on('submit', function(e){
e.preventDefault();
$.ajax({
dataType : 'json',
type: "POST",
url: 'hit.php',
data : {action : 'count_word_prism', Post : form.serialize()},
beforeSend: function(){
},
success: function(Response){
}
});
});
I there is PHP code which i was try already.
extract($_POST);
if ($Post) {
parse_str($Post, $get_array);
echo"<PRE>";
print_r($get_array['WordText']);
echo"</PRE>";
echo"<PRE>";
print_r($_FILES['WordFile']);
echo"</PRE>";
}
If any solution for this please post your answer.