Merge pull request '- determining MIME-type fixed, works across all platforms' (#1) from mime into master
Reviewed-on: #1
This commit is contained in:
		
						commit
						1a44270c82
					
				@ -255,9 +255,12 @@ switch ($action) {
 | 
				
			|||||||
                    if (isset($_FILES["game_file"])) {
 | 
					                    if (isset($_FILES["game_file"])) {
 | 
				
			||||||
                        // decide weather it's a package or a plain table
 | 
					                        // decide weather it's a package or a plain table
 | 
				
			||||||
                        $file = $_FILES["game_file"];
 | 
					                        $file = $_FILES["game_file"];
 | 
				
			||||||
                        $file_type = $file["type"];
 | 
					 | 
				
			||||||
                        $challenge_import_status = [];
 | 
					                        $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;
 | 
					                            $zip = new ZipArchive;
 | 
				
			||||||
                            if ($zip->open($file["tmp_name"])) {
 | 
					                            if ($zip->open($file["tmp_name"])) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -279,7 +282,7 @@ switch ($action) {
 | 
				
			|||||||
                                    $challenge_import_status = import_challenges_from_csv($csv_files[0], $gameid);
 | 
					                                    $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);
 | 
					                            $challenge_import_status = import_challenges_from_csv($file["tmp_name"], $gameid);
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        $result = json_encode($challenge_import_status);
 | 
					                        $result = json_encode($challenge_import_status);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user