- determining MIME-type fixed, works across all platforms
This commit is contained in:
		
							parent
							
								
									0980abfdd4
								
							
						
					
					
						commit
						9d91118e68
					
				@ -243,9 +243,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"])) {
 | 
			
		||||
 | 
			
		||||
@ -267,7 +270,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);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user