game_jam_id); $gameJamStartTime = strtotime($gameJam->start_time); $gameJamEndTime = strtotime($gameJam->end_time); $date = date('Y/m/d H:i:s', time()); $currentTime = strtotime($date); if($gameJamStartTime <= $currentTime && $gameJamEndTime >= $currentTime){ if(!isset($group->game_data_id)){ if(isset($_POST['submitUpload'])){ //Get the data from the user form $gameFile = $_FILES['gameFile']; $desc = $_POST['description']; $title = $_POST['gameTitle']; $thumbnail = $_FILES['thumbnailFile']; $isWebBased = isset( $_POST['isWebBased']); $gameFileName = $_FILES['gameFile']['name'];//Game name $gameFileTmp = $_FILES['gameFile']['tmp_name'];//Tmp location of the file $gameFileError = $_FILES['gameFile']['error'];//File error $thumbnailFileName = $_FILES['thumbnailFile']['name'];//Game name $thumbnailFileTmp = $_FILES['thumbnailFile']['tmp_name'];//Tmp location of the file $thumbnailFileError =$_FILES['thumbnailFile']['error'];//File error if($gameFileError === 0){ $gameData = new GameData(); $gameData->game_name = $title; $gameData->game_link = ZipFileHandler($gameFileName,$gameFileTmp); $gameData->description = $desc; if(isset($thumbnail) && $thumbnailFileError === 0){ $gameData->img = imagesFileHandler($thumbnailFileName,$thumbnailFileTmp); } $gameData->is_web_Based = $isWebBased; $gameData->save(); $group->gameData()->associate($gameData); if(! $group->save()){ echo http_response_code(500); }else{ echo http_response_code(201); } } }else{ echo http_response_code(400); } }else{ echo "Can only upload one file"; echo http_response_code(400); } }else{ echo "Can only upload when the game jam has started"; echo http_response_code(400); } }else{ echo http_response_code(401); }