I've been going mad this past month trying to build a page to submit a pdf asynchronously to our server. I'm an experienced programmer, but never worked in web-dev or in php or javascript.
The javascript submission function is as follows:
function sendFile(event)
{
$("#submitForm").hide();
var formData = new FormData();
var file=$("#journal")[0].files[0];
formData.append("document", file);
$.ajax("converter.php", { data:formData, processData:false, dataType:"text", method:"post", success:function(data, textStatus, jqXHR){
if(data.length == 8)
{
$("#key_input").val(data);
$("#key_submission").submit();
}
else
{
$("#response").html(data);
}
} });
It submits to the server but as soon the php script reaches this line
if(isset($_POST['document']))
the program crashes and I get an internal server error. What could be causing the crash?