This commit is contained in:
parent
43bf4c0baa
commit
f056db13d8
@ -51,6 +51,12 @@
|
||||
|
||||
</textarea>
|
||||
</div>
|
||||
<div class="row cv-upload-section">
|
||||
<p class="col-lg-8" style="font-size: 14px;">Image : <span id="cv-m-upload-name">Aucune image !</span></p>
|
||||
<button id="cv-m-upload-btn" style="margin-left: 10%;" class="col-lg-2 cv-upload"><i class="fa fa-upload"></i> Upload</button>
|
||||
<input id='cv-m-upload-file' type='file' hidden/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row w-100">
|
||||
<button id="cv-project-save" class="cv-save col-lg-2"><i class="fa fa-save"></i> Sauvegarder</button>
|
||||
@ -124,6 +130,10 @@
|
||||
const projectUploadBtn = document.getElementById("cv-upload-btn")
|
||||
const projectUploadName = document.getElementById("cv-upload-name")
|
||||
|
||||
const eprojectUploadFile = document.getElementById("cv-m-upload-file")
|
||||
const eprojectUploadBtn = document.getElementById("cv-m-upload-btn")
|
||||
const eprojectUploadName = document.getElementById("cv-m-upload-name")
|
||||
|
||||
var sectionSelectedMD = null;
|
||||
var projectSelectedMD = null;
|
||||
|
||||
@ -251,6 +261,58 @@
|
||||
projectUploadFile.click()
|
||||
})
|
||||
|
||||
eprojectUploadBtn.addEventListener("click", () => {
|
||||
|
||||
eprojectUploadFile.click()
|
||||
})
|
||||
|
||||
eprojectUploadFile.addEventListener("change", () => {
|
||||
|
||||
eprojectUploadName.innerHTML = eprojectUploadFile.files[0].name
|
||||
|
||||
if(eprojectUploadFile.files.length > 0) {
|
||||
|
||||
const file_acc = new FormData();
|
||||
file_acc.append("apic", eprojectUploadFile.files[0])
|
||||
|
||||
fetch('/upload', {
|
||||
method: 'POST',
|
||||
mode:"cors",
|
||||
cache:"no-cache",
|
||||
credentials:"same-origin",
|
||||
headers: {
|
||||
"uploadforproject": projectSelector.value
|
||||
|
||||
},
|
||||
referrerPolicy:"no-referrer",
|
||||
redirect: 'follow',
|
||||
body: file_acc
|
||||
}).then(response => response.json())
|
||||
.then(response => resupload(response))
|
||||
|
||||
function resupload(response) {
|
||||
|
||||
|
||||
if(response.result == "ERROR") {
|
||||
projectInfo.innerHTML = "L'image n'a pas été upload !"
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
projectInfo.innerHTML = "<span style='color:rgb(130, 255, 163); '>L'image a été correctement upload !</span>"
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
projectDelete.addEventListener("click", () => {
|
||||
|
||||
const opt = projectSelector.value
|
||||
|
@ -9,5 +9,5 @@
|
||||
"livableToken": true,
|
||||
"createdAt": 1679260759114
|
||||
},
|
||||
"lastconnexion": 1680108499963
|
||||
"lastconnexion": 1680117724684
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user