diff options
author | adam <adam@> | 2021-02-12 19:54:59 +0200 |
---|---|---|
committer | adam <adam@> | 2021-02-12 19:54:59 +0200 |
commit | 3c00b31a63c37d13742bdf8d551bef42a84ffcd3 (patch) | |
tree | fbe19bb3cc578ff59346adaa41a72bb9bc0e8b3f | |
parent | af0c31ec0ebbfabd3f6140b816752ccf96313225 (diff) | |
parent | ca628a59b1d319cf6fc0da2b65e42b9e375e4f22 (diff) | |
download | fileup-3c00b31a63c37d13742bdf8d551bef42a84ffcd3.tar.gz |
Merge branch 'master' of https://github.com/alexvitkov/india
-rw-r--r-- | loggedin.js | 17 | ||||
-rw-r--r-- | loggedin.php | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/loggedin.js b/loggedin.js index 5f1f2d4..01c8226 100644 --- a/loggedin.js +++ b/loggedin.js @@ -146,6 +146,23 @@ function rename_file(filename) { xhr.send(data); } +function new_folder() { + var dirname = prompt(`Directory name`, "New Folder"); + if (!dirname) + return; + + var data = new FormData(); + data.append('parent_directory', get_path()); + data.append('dirname', dirname); + + var xhr = new XMLHttpRequest(); + xhr.open('POST', '/php/mkdir.php', true); + xhr.onload = function () { + load_dir(); + }; + xhr.send(data); +} + function add_file_visuals(name, is_directory, mimetype) { var fileDiv = document.createElement('div'); diff --git a/loggedin.php b/loggedin.php index 5c900c9..a084754 100644 --- a/loggedin.php +++ b/loggedin.php @@ -3,10 +3,9 @@ <h2 style="display: flex; gap: 0rem;"> <button id="upload_btn" onclick="begin_upload()">Upload</button> <div class="separator"></div> - <button id="upload_btn" onclick="begin_upload()">New Folder</button> + <button id="upload_btn" onclick="new_folder()">New Folder</button> <div class="separator"></div> <div class="path" id="the_path"> - <!-- <a class="pathentry" href="#"> /</a><a class="pathentry" href="#">foo/</a><a class="pathentry" href="#">bar</a> --> <button class="pathentry" onclick="pwd.length = 0; load_dir();"><?php echo $_SESSION['username'] ?>'s files</button> </div> </h2> |