Game-Jaming/Frontend/Javascript/UplodeFiles.js

30 lines
1007 B
JavaScript

$(document).ready(function () {
axios.defaults.baseURL = "http://localhost/Game-Jaming";
$("#uploadFile").submit(function (e) {
let URL = "/Backend/Controllers/FileHandler/upload.php";
const params = new URLSearchParams();
params.append("submitUpload", document.getElementById("indsend1").value);
params.append(
"gameJamId",
document.getElementById("datalistOptions").value
);
params.append("gameTitle", document.getElementById("Text1").value);
params.append("description", document.getElementById("Text2").value);
params.append("gameFile", document.getElementById("formFile1").value);
params.append("thumbnailFile", document.getElementById("formFile2").value);
params.append("isWebBased", document.getElementById("Switch1").checked);
axios
.post(URL, params)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
e.preventDefault();
});
});