From 1c5476e68cc0d43b534521ea3e647bbe0d7e86df Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Fri, 12 Feb 2021 14:05:49 +0200 Subject: drop table order --- php/upload.php | 2 -- sql/fileshare.sql | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/php/upload.php b/php/upload.php index 0aefefc..01ab6a6 100644 --- a/php/upload.php +++ b/php/upload.php @@ -9,8 +9,6 @@ if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"])) exit(1); } -echo "adsf"; - $file = $_FILES["the_file"]; $filename= $_POST["filename"]; diff --git a/sql/fileshare.sql b/sql/fileshare.sql index b0f1696..0742538 100644 --- a/sql/fileshare.sql +++ b/sql/fileshare.sql @@ -1,8 +1,8 @@ /*BEWARE!*/ -drop table if exists users; -drop table if exists nodes; drop table if exists node_access; +drop table if exists users; drop table if exists node_links; +drop table if exists nodes; -- cgit v1.2.3 From 1de4d8dea14a9641206cd91613388ee5f228bae5 Mon Sep 17 00:00:00 2001 From: Alex Vitkov Date: Fri, 12 Feb 2021 14:21:12 +0200 Subject: front end for readdir --- loggedin.js | 27 +++++++++++++++++++++++++-- php/readdir.php | 3 +++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/loggedin.js b/loggedin.js index 436719f..d774e16 100644 --- a/loggedin.js +++ b/loggedin.js @@ -8,7 +8,9 @@ const current_directory = document.getElementById("current_directory"); the_file.onchange = on_file_added; -const files = []; +var files = []; + +const pwd = "/"; const pending_uploads = []; @@ -44,7 +46,26 @@ function on_file_added(_e) { } -function add_file_visuals(name, pending) { +function load_dir(pwd) { + var data = new FormData(); + data.append('path', '/'); + + var xhr = new XMLHttpRequest(); + xhr.open('POST', '/php/readdir.php', true); + xhr.onload = function () { + for (const f of files) + f[1].remove(); + files = []; + + var json = JSON.parse(this.responseText); + for (const f of json) { + add_file_visuals(f.name, f.mimetype); + } + }; + xhr.send(data); +} + +function add_file_visuals(name, mimetype) { var fileDiv = document.createElement('div'); var img = document.createElement('img'); @@ -68,3 +89,5 @@ function add_file_visuals(name, pending) { function begin_upload() { the_file.click(); } + +load_dir("/"); diff --git a/php/readdir.php b/php/readdir.php index e69de29..b6a1916 100644 --- a/php/readdir.php +++ b/php/readdir.php @@ -0,0 +1,3 @@ + -- cgit v1.2.3