<?php
if (isset($_FILES['video']) && $_FILES['video']['error'] == UPLOAD_ERR_OK) {
    $video_name = uniqid() . "_" . $_FILES['video']['name'];
    $video_path = "uploads/videos/" . $video_name;
    if (move_uploaded_file($_FILES['video']['tmp_name'], $video_path)) {
        // Send back the path as JSON
        echo json_encode(['file_path' => $video_path]);
    } else {
        echo json_encode(['error' => 'File upload failed']);
    }
}
?>
