You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.4 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload to the archive</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container recorder">
<header>
<h1>Signal lost archive unzipped</h1>
<p>some info on what this even is</p>
</header>
<button class='fn-start-recording button--record'>
<span class="button__label">RECORD</span>
</button>
<a href="" class="fn-file-upload">Upload a file instead</a>
<audio controls></audio>
</div>
<section class='upload'>
<form enctype="multipart/form-data" class="fn-upload-form" action="upload.php" method="POST">
<input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
</section>
<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";
}
}
?>