Oprava upload scriptu a úprava načítání videí

closes #8
This commit is contained in:
2021-02-02 00:18:41 +01:00
parent 4db0ce0d9d
commit e1d03f1658
3 changed files with 54 additions and 41 deletions

View File

@@ -26,11 +26,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
move_uploaded_file(
$_FILES["videoFile"]["tmp_name"],
"videos/R-" .
"videos/" .
$generatedFileName . "." . $extension
);
writeToFile("videos/" . $generatedFileName . ".xml", $_POST["xmlFile"]);
shell_exec("./transcode.sh > /dev/null 2>&1 &");
$xml = $_POST["xmlFile"];
$xml = str_replace("<video>", '<video src="' . $generatedFileName . '.' . $extension . '">', $xml);
writeToFile("videos/" . $generatedFileName . ".xml", $xml);
redirect("?v=" . $generatedFileName);
}
} else {
@@ -40,7 +42,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
redirect();
}
function writeToFile($file, $xml) {
function writeToFile($file, $xml)
{
$myfile = fopen($file, "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $xml);
@@ -63,4 +66,3 @@ function generateRandomString($length = 4)
}
return $randomString;
}
?>