diff --git a/interface.php b/interface.php index cc6b863..a7b69b6 100644 --- a/interface.php +++ b/interface.php @@ -255,9 +255,12 @@ switch ($action) { if (isset($_FILES["game_file"])) { // decide weather it's a package or a plain table $file = $_FILES["game_file"]; - $file_type = $file["type"]; $challenge_import_status = []; - if ($file_type === "application/zip") { // a package was uploaded + + // determine MIME type + $file_type = strtolower(pathinfo($file["name"], PATHINFO_EXTENSION)); + + if ($file_type === "zip") { // a package was uploaded $zip = new ZipArchive; if ($zip->open($file["tmp_name"])) { @@ -279,7 +282,7 @@ switch ($action) { $challenge_import_status = import_challenges_from_csv($csv_files[0], $gameid); } } - } else if ($file_type === "text/csv") { // a plain table was uploaded + } else if ($file_type === "csv") { // a plain table was uploaded $challenge_import_status = import_challenges_from_csv($file["tmp_name"], $gameid); } $result = json_encode($challenge_import_status);