fix
This commit is contained in:
@@ -36,6 +36,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($type === 'video' && $video_platform === 'local' && isset($_FILES['video_file']) && $_FILES['video_file']['error'] === UPLOAD_ERR_OK) {
|
||||
$upload_dir = $is_demo ? '../uploads/lessons/demo/' : '../uploads/lessons/pay/';
|
||||
|
||||
// Crea le cartelle se non esistono
|
||||
if (!is_dir($upload_dir)) {
|
||||
mkdir($upload_dir, 0755, true);
|
||||
}
|
||||
|
||||
// Crea nome file sicuro
|
||||
$file_extension = strtolower(pathinfo($_FILES['video_file']['name'], PATHINFO_EXTENSION));
|
||||
$allowed_extensions = ['mp4', 'webm', 'ogg', 'mov'];
|
||||
@@ -49,6 +54,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if (move_uploaded_file($_FILES['video_file']['tmp_name'], $upload_path)) {
|
||||
// Imposta il percorso relativo per il database
|
||||
$video_url = '/uploads/lessons/' . ($is_demo ? 'demo' : 'pay') . '/' . $file_name;
|
||||
|
||||
// Estrai durata automaticamente se non specificata
|
||||
if (empty($duration)) {
|
||||
$duration = get_video_duration($upload_path);
|
||||
}
|
||||
} else {
|
||||
$error = 'Errore durante il caricamento del file';
|
||||
}
|
||||
|
||||
@@ -65,6 +65,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($type === 'video' && $video_platform === 'local' && isset($_FILES['video_file']) && $_FILES['video_file']['error'] === UPLOAD_ERR_OK) {
|
||||
$upload_dir = $is_demo ? '../uploads/lessons/demo/' : '../uploads/lessons/pay/';
|
||||
|
||||
// Crea le cartelle se non esistono
|
||||
if (!is_dir($upload_dir)) {
|
||||
mkdir($upload_dir, 0755, true);
|
||||
}
|
||||
|
||||
// Crea nome file sicuro
|
||||
$file_extension = strtolower(pathinfo($_FILES['video_file']['name'], PATHINFO_EXTENSION));
|
||||
$allowed_extensions = ['mp4', 'webm', 'ogg', 'mov'];
|
||||
@@ -82,6 +87,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
// Imposta il nuovo percorso
|
||||
$video_url = '/uploads/lessons/' . ($is_demo ? 'demo' : 'pay') . '/' . $file_name;
|
||||
|
||||
// Estrai durata automaticamente se non specificata
|
||||
if (empty($duration)) {
|
||||
$duration = get_video_duration($upload_path);
|
||||
}
|
||||
} else {
|
||||
$error = 'Errore durante il caricamento del file';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user