I want to upload a pdf from jspdf to my server. I use Ajax for it.
I open the Javascript by a function in my form.
onsubmit="pdferzeugen();"
above the ajax code i create the pdf by "jspdf" and save it to a datauri (base64).
Javascript:
var datauri = pdf.output('datauri');
var data = new FormData();
data.append("pdf_data", datauri);
    
$.ajax({
    url: "./uploads/upload.php",
    type: "POST",
    processData: false,
    contentType: false,
    data: data,
});
upload.php:
if(!empty($_POST['pdf_data'])){
    $data = $_POST['pdf_data'];
    $fname = "test.pdf"; // name the file
    $file = fopen("./uploads/" .$fname, 'w'); // open the file path
    fwrite($file, $data); //save data
    fclose($file);
}
But this isnt working for me. Chrome always say:
jquery.min.js:9600 XHR failed loading: POST "http://app-her-visitor/begehung/uploads/upload.php".
I searched whole google for this error, but no success. I hope you can help me :-)
Thanks for help
Greetings
 
    