Oprava upload scriptu

David Zálešák 4 years ago
parent 03d81b1908
commit c34f36bfc8

@ -1,6 +1,6 @@
<?php <?php
if ($_SERVER["REQUEST_METHOD"] == "POST") { if ($_SERVER["REQUEST_METHOD"] == "POST") {
$allowedExts = array("mp4", "mov", "wmv", "flv", "avi", "avchd", "webm", "mkv"); $allowedExts = array("mp4", "mov", "wmv", "flv", "avi", "avchd", "webm", "mkv", "mpeg");
$extension = pathinfo($_FILES['videoFile']['name'], PATHINFO_EXTENSION); $extension = pathinfo($_FILES['videoFile']['name'], PATHINFO_EXTENSION);
if ((($_FILES["videoFile"]["type"] == "video/mp4") if ((($_FILES["videoFile"]["type"] == "video/mp4")
@ -14,7 +14,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|| ($_FILES["videoFile"]["type"] == "video/3gpp2")) || ($_FILES["videoFile"]["type"] == "video/3gpp2"))
&& ($_FILES["videoFile"]["size"] < 500000000) && ($_FILES["videoFile"]["size"] < 500000000)
&& in_array($extension, $allowedExts) && in_array(strtolower($extension), $allowedExts)
&& isset($_POST["xmlFile"]) && isset($_POST["xmlFile"])
) { ) {
if ($_FILES["videoFile"]["error"] > 0) { if ($_FILES["videoFile"]["error"] > 0) {
@ -46,7 +46,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
function writeToFile($file, $xml) function writeToFile($file, $xml)
{ {
$myfile = fopen($file, "w") or die("Unable to open file!"); $myfile = fopen($file, "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $xml); fwrite($myfile, $xml);
fclose($myfile); fclose($myfile);
} }

Loading…
Cancel
Save