Repair uploading of files

This commit is contained in:
Nicolas H 2022-04-13 17:39:55 +02:00
parent 30dba0b0ca
commit 325bcf8746
2 changed files with 3 additions and 3 deletions

View File

@ -137,7 +137,8 @@ else if (isset($_POST['action']))
case 'sendfile': case 'sendfile':
$file=urldecode($_POST['name']); $file=urldecode($_POST['name']);
$filedetail = pathinfo($file); $filedetail = pathinfo($file);
$data=$_POST['file']; $data=file_get_contents($_FILES["file"]["tmp_name"]);
unlink($_FILES["file"]["tmp_name"]);
if (!isset($_SESSION['md_admin'])) if (!isset($_SESSION['md_admin']))
{ {
$content=specialurl("/:ADMIN",true); $content=specialurl("/:ADMIN",true);

View File

@ -366,7 +366,6 @@ function sendmode(data)
{ {
$(window).scrollTop(0); $(window).scrollTop(0);
$("#editor").hide(); $("#editor").hide();
if (data !== undefined) editor.value(data);
$("#content").show(); $("#content").show();
$("#save").hide(); $("#save").hide();
$("#image").hide(); $("#image").hide();
@ -374,7 +373,7 @@ function sendmode(data)
$("#voir").val("Voir"); $("#voir").val("Voir");
$("#content").html('<div id="drop-area"><form class="my-form"><p>'+LANG['UPLOAD_MSG']+'</p><input type="file" id="fileElem" multiple accept="image/*" onchange="handleFiles(this.files)"><label class="button" for="fileElem">'+LANG['UPLOAD_BTN']+'</label></form><progress id="progress-bar" max=100 value=0></progress><div id="gallery" /></div></div>'); $("#content").html('<div id="drop-area"><form class="my-form"><p>'+LANG['UPLOAD_MSG']+'</p><input type="file" id="fileElem" multiple accept="image/*" onchange="handleFiles(this.files)"><label class="button" for="fileElem">'+LANG['UPLOAD_BTN']+'</label></form><progress id="progress-bar" max=100 value=0></progress><div id="gallery" /></div></div>');
let dropArea = document.getElementById("drop-area") let dropArea = document.getElementById("drop-area")
dropArea.replaceWith(dropArea.cloneNode(true)); //dropArea.replaceWith(dropArea.cloneNode(true));
;['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { ;['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
dropArea.addEventListener(eventName, preventDefaults, false) dropArea.addEventListener(eventName, preventDefaults, false)