<?php
if(isset($_FILES['attendance_file'])){

    $fileName = $_FILES['attendance_file']['name'];
    $fileTmp = $_FILES['attendance_file']['tmp_name'];

    $allowed = ['xls','xlsx'];
    $ext = pathinfo($fileName, PATHINFO_EXTENSION);

    if(!in_array($ext, $allowed)){
        die("Invalid file format. Only Excel files allowed.");
    }

    move_uploaded_file($fileTmp, "uploads/" . $fileName);

    echo "Excel Uploaded Successfully!";
}
?>
