add response in view

main
vitrinekast 12 months ago
parent 1f99151f3c
commit 9309a7451e

1
.gitignore vendored

@ -0,0 +1 @@
./webinterface/uploads

@ -14,6 +14,7 @@
<header> <header>
<h1>Signal lost archive unzipped</h1> <h1>Signal lost archive unzipped</h1>
<p>some info on what this even is</p> <p>some info on what this even is</p>
<span class='fn-error'></span>
</header> </header>
<button class='fn-start-recording button--record'> <button class='fn-start-recording button--record'>

@ -13,7 +13,8 @@ var sendFile = async function (blob) {
body: formData body: formData
}); });
console.log(response.json())
return response.json()
} }
var initRecording = function (autostart) { var initRecording = function (autostart) {
@ -42,7 +43,9 @@ var initRecording = function (autostart) {
const audioURL = window.URL.createObjectURL(blob); const audioURL = window.URL.createObjectURL(blob);
audioEl.src = audioURL; audioEl.src = audioURL;
console.log(audioEl.src); console.log(audioEl.src);
sendFile(blob); sendFile(blob).then((data) => {
document.querySelector(".fn-error").textContent = data
});
} }
if (autostart) { if (autostart) {

@ -9,9 +9,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// TODO check file type // TODO check file type
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n"; echo json_encode("File is valid, and was successfully uploaded.\n");
} else { } else {
echo "Possible file upload attack!\n"; echo json_encode( "Possible file upload attack!\n");
} }
} }
?> ?>
Loading…
Cancel
Save