| Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 Path : /home/u901718425/public_html/php/ |
| Current File : /home/u901718425/public_html/php/files_video.php |
<?php
include("../panel/globale.php");
function files_m($file,$name){
$target_dir = "";
$target_file = $target_dir.'urbanpillar_'.$name."_".rand()."_".basename($file["name"]);
$videoFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
$check = ['mp4','webp','mkv'];
if(file_exists($target_file)){
unlink($target_file);
}
if ( in_array($videoFileType, $check) && move_uploaded_file($file["tmp_name"],getenv('FILE_CDN_MOVE').$target_file)) {
$out[0] = 'success';
$out[1][] = $target_file;
}else{
$out[0][] = 'error';
}
return $out;
}
// error upload function
function errorlog($page,$res,$sql,$db){
$error['id'] = ($db->max("error_log") == NULL? 1 : (int)$db->max("error_log") + 1);
$error['page'] = $_POST['page'];
$error['error'] = $db->sanitize($res);
$error['query'] = $db->sanitize($sql);
$error['status'] = "not solved";
$db->insert("error_log",$error);
}
if (isset($_POST)) {
if(isset($_POST['title'] ) && $_POST['title'] !==""){
if (isset($_FILES) && isset($_POST['allow']) && $_FILES[$_POST['allow']]['name']!="" ){
$s = files_m($_FILES[$_POST['allow']],$_POST['title']);
if($s[0] == 'success' ){
$data[$key] = json_encode($s[1]);
}else{
errorlog($_POST['page'],"File Not Uploaded","",$db);
}
$res = $s;
}
}else{
$res[0] = 'error';
$res[1] = 'property name is blank';
$res[2] = 'title';
}
if(isset($res) && !empty($res)){
echo json_encode($res);
}
}