Fixed som stuff

This commit is contained in:
neerholt 2021-03-08 14:52:34 +01:00
parent b242918038
commit ea3bc7d104
4 changed files with 10 additions and 7 deletions

View File

@ -0,0 +1 @@
<?php

View File

@ -1,5 +1,5 @@
<?php
require_once "../../bootstrap.php";
require_once "../../../bootstrap.php";
use Backend\Models\GameData;
@ -8,7 +8,7 @@ if(isset($_POST['submitUpload'])){
$gameFile = $_FILES['gameFile'];
$desc = $_POST['description'];
$title = $_POST['gameTitle'];
$isWebBased = $_POST['isWebBased'];
$isWebBased = isset( $_POST['isWebBased']);
//Handle data for game files
@ -28,16 +28,18 @@ if(isset($_POST['submitUpload'])){
if($gameFileError === 0){
$gameFileNewName = uniqid("", true). "." . $fileActualExt;
if(empty($gameFileName)){
header("location: ./index.php?error=emptyFile");
header("location: ../../../Frontend/index.php?error=emptyFile");
exit();
}else{
$gameData = new GameData();
$gameData->game_name = $title;
$gameData->game_link = $gameFileNewName;
$gameData->description = $desc;
$gameData->is_web_Based = $isWebBased;
$gameData->save();
rename($gameFileTmp,"../Games/".$gameFileNewName);
rename($gameFileTmp,"../../Games/".$gameFileNewName);
}
}else{
echo "Der var en fejl med at uploade din file";

View File

@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model as Eloquent;
class GameData extends Eloquent
{
protected $fillable = [
'game_name', 'game_link', 'is_web_Based', "img"
'game_name', 'game_link', 'is_web_Based', 'description' , "img"
];
public function group(){

View File

@ -17,7 +17,7 @@
<form action="../Backend/Controllers/upload.php" method="POST" id="uploadGame" enctype="multipart/form-data">
<form action="../Backend/Controllers/FileHandler/upload.php" method="POST" id="uploadGame" enctype="multipart/form-data">
<input type="text" name="gameTitle" placeholder="Title på spillet"><br><br>
@ -27,7 +27,7 @@
<input type="file" name="gameFile" placeholder="Upload dit spil"><br><br>
<label for="web">Er spillet web based</label>
<input type="checkbox" id="web" name="isWebBased" value="true"><br><br>
<input type="checkbox" id="web" name="isWebBased" value="1"><br><br>
<input type="submit" name="submitUpload" value="Submit">
</form>