move php to own dir
This commit is contained in:
1 parent
2232ce74de
commit
a644469897
2 files changed
+1
-1
No files matched your search
Executable
+72
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
$username = $_SERVER['PHP_AUTH_USER'];
|
||||
$target_dir = "/var/www/html/aliceclass_videos/" . $username;
|
||||
|
||||
# check if user dir exists
|
||||
if (!file_exists($target_dir)) {
|
||||
|
||||
# if not, create it
|
||||
if (mkdir($target_dir, 0775, true)) {
|
||||
// echo "Directory created successfully.";
|
||||
}
|
||||
|
||||
if (mkdir($target_dir . "/src", 0775, true)) {
|
||||
// echo "Directory created successfully.";
|
||||
}
|
||||
|
||||
if (mkdir($target_dir . "/dest", 0775, true)) {
|
||||
// echo "Directory created successfully.";
|
||||
}
|
||||
}
|
||||
|
||||
$fileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
|
||||
$uploadOk = 1;
|
||||
|
||||
// if ($fileType != '.mkv') {
|
||||
// echo "Apenas arquivos .mkv são aceitos. ";
|
||||
// $uploadOk = 0;
|
||||
// }
|
||||
|
||||
// echo $_POST["videoTitle"];
|
||||
$ext = ".mkv";
|
||||
|
||||
$video_title = $_POST["videoTitle"];
|
||||
$video_desc = $_POST["videoDescription"];
|
||||
$video_date = date('d/m/Y');
|
||||
$video_level = $_POST["level"];
|
||||
|
||||
$brute_file = $target_dir . "/src/" . $video_title . $ext;
|
||||
$target_file = $target_dir . "/dest/" . $video_title . '.mp4';
|
||||
|
||||
// echo $video_title . $video_desc . $video_date . $video_level;
|
||||
// echo $target_file;
|
||||
// return;
|
||||
|
||||
// Check if file already exists
|
||||
if (file_exists($brute_file)) {
|
||||
echo "Sorry, file already exists.";
|
||||
$uploadOk = 0;
|
||||
}
|
||||
|
||||
if ($uploadOk == 1) {
|
||||
if (!move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $brute_file)) {
|
||||
echo "Houve um problema com o upload do arquivo.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// return;
|
||||
|
||||
// ./script.sh "TESTE" "TESTAO" "/home/carneiro/Introdução ao LMMS.mkv" "AULATESTE" /home/carneiro/teste.mp4
|
||||
|
||||
echo "The file ". htmlspecialchars(basename( $_FILES["videoTitle"]["name"])). " has been uploaded.";
|
||||
$SCRIPT_PATH = "/var/www/src/AliceClass/script/script.sh";
|
||||
$AUTHOR = $username;
|
||||
$NAME = $_POST["videoTitle"];
|
||||
$INPUT = $brute_file;
|
||||
$OUTPUT = $target_file;
|
||||
|
||||
$cmd = sprintf('%s "%s" "%s" "%s" "%s" "%s"', $SCRIPT_PATH, $NAME, $AUTHOR, $INPUT, 'aulateste', $OUTPUT);
|
||||
$output = shell_exec($cmd);
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user