@ -37,19 +37,4 @@
<script type="text/javascript" src="script.js"></script>
</body>
</html>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$uploaddir = '/opt/homebrew/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
?>
@ -3,15 +3,17 @@ let chunks = [];
var mediaRecorder = false;
var sendFile = function (blob) {
var sendFile = async function (blob) {
const formData = new FormData();
formData.append('userfile', blob, new Date() + ".webm");
return fetch('upload.php', {
const response = await fetch('upload.php', {
method: 'POST',
body: formData
});
console.log(response.json())
var initRecording = function (autostart) {
@ -6,6 +6,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$uploaddir = getcwd() . '/uploads/';
// TODO check file type