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.
97 lines
3.4 KiB
PHP
97 lines
3.4 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<title>Upload to the archive</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
|
|
<body>
|
|
<canvas width="800px" height="800px"></canvas>
|
|
<section class='multi'>
|
|
<div class="multi__top">
|
|
|
|
<div class="state state--finished">
|
|
<h1>Great Success!</h1>
|
|
<p>Your broadcast is now part of the community archive, and will be broadcasted asap.</p>
|
|
<p>Stay strong, survivor!</p>
|
|
</div>
|
|
|
|
<div class="state state--idle">
|
|
<h1>Radio Studio V0.1</h1>
|
|
<p>Start your community stream, together with another survivor</p>
|
|
<a href="" class="fn-open-dialog-form">Upload a file instead</a>
|
|
</div>
|
|
|
|
<div class="state state--waiting">
|
|
<h1>Making radio unzipped</h1>
|
|
<p>waiting for your friend</p>
|
|
</div>
|
|
<button class="button--record fn-touch-record" target="top"></button>
|
|
</div>
|
|
|
|
<div class="multi__bottom">
|
|
|
|
<div class="state state--finished">
|
|
<h1>Great Success!</h1>
|
|
<p>Your broadcast is now part of the community archive, and will be broadcasted asap.</p>
|
|
<p>Stay strong, survivor!</p>
|
|
</div>
|
|
|
|
<div class="state state--idle">
|
|
<h1>Radio Studio V0.1</h1>
|
|
<p>Start your community stream, together with another survivor</p>
|
|
<a href="" class="fn-open-dialog-form">Upload a file instead</a>
|
|
</div>
|
|
|
|
<div class="state state--waiting">
|
|
<h1>Radio Studio V0.1</h1>
|
|
<p>waiting for your friend</p>
|
|
</div>
|
|
<button class="button--record fn-touch-record" target="bottom"></button>
|
|
</div>
|
|
</section>
|
|
|
|
<dialog class='fn-dialog-form'>
|
|
<form method="dialog" class='dialog__close'>
|
|
<button class="button--icon">
|
|
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
|
|
<path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" />
|
|
</svg>
|
|
</button>
|
|
</form>
|
|
|
|
<form enctype="multipart/form-data" class="fn-upload-form" action="" method="POST">
|
|
<label for="file">Select a file to upload</label>
|
|
<input name="userfile" id="file" type="file" />
|
|
<input type="submit" value="Send File" />
|
|
</form>
|
|
|
|
</dialog>
|
|
|
|
<script type="text/javascript" src="script.js"></script>
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
<?php
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
|
$uploaddir = getcwd() . '/uploads/';
|
|
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
|
|
|
|
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
|
|
$base = pathinfo($uploadfile)['filename'];
|
|
|
|
echo shell_exec("/usr/bin/ffmpeg -i " . $uploadfile . " /var/www/html/radio/random-radio-radio/webinterface/uploads/" . $base . ".wav 2>&1");
|
|
|
|
echo json_encode("File is valid, and was successfully uploaded.\n");
|
|
} else {
|
|
echo json_encode("Possible file upload attack!\n");
|
|
}
|
|
}
|
|
?>
|