FILEUP



LOG | FILES | OVERVIEW


F diff --git a/loggedin.js b/loggedin.js --- a/loggedin.js +++ b/loggedin.js
the_file.onchange = on_file_added;
- const files = [];
+ var files = [];
+
+ const pwd = "/";
const pending_uploads = [];
}
- 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');
function begin_upload() {
the_file.click();
}
+
+ load_dir("/");
F diff --git a/php/readdir.php b/php/readdir.php --- a/php/readdir.php +++ b/php/readdir.php
+ <?php
+ echo '[ { "name": "file1.txt", "mimetype": "text/plain", "is_directory": false }, { "name": "file2.pdf", "mimetype": "application/pdf", "is_directory": false }, { "name": "dir", "mimetype": "", "is_directory": true } ] ';
+ ?>
F diff --git a/php/upload.php b/php/upload.php --- a/php/upload.php +++ b/php/upload.php
exit(1);
}
- echo "adsf";
-
$file = $_FILES["the_file"];
$filename= $_POST["filename"];
F diff --git a/sql/fileshare.sql b/sql/fileshare.sql --- a/sql/fileshare.sql +++ b/sql/fileshare.sql
/*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;