F diff --git a/loggedin.js b/loggedin.js
--- a/loggedin.js
+++ b/loggedin.js
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');
F diff --git a/loggedin.php b/loggedin.php
--- a/loggedin.php
+++ b/loggedin.php
<h2 style="display: flex; gap: 0rem;">
<button id="upload_btn" onclick="begin_upload()">Upload</button>
<div class="separator"></div>
- <button id="upload_btn" onclick="new_folder()">New Folder</button>
+ <button id="upload_btn" onclick="begin_upload()">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>
F diff --git a/php/database.php b/php/database.php
--- a/php/database.php
+++ b/php/database.php
}
}
/*returns the file name as it must be in the filesystem relative to the storage root*/
- function create_file_node(string $filename,string $note,int $dir_id,User $user): string
+ function create_file_node(string $filename,string $note,int $dir_id,string $mimetype,User $user): string
{
global $storage_root;
/*checkout the directory*/
F diff --git a/php/file_type_recogniser.php b/php/file_type_recogniser.php
--- a/php/file_type_recogniser.php
+++ b/php/file_type_recogniser.php
function file_type($path_to_file) {
$file_type_database = new finfo(FILEINFO_SYMLINK|FILEINFO_MIME_TYPE);
- return $file_type_database->file($path_to_file);
+ return $file_type_database->file($path_to_file);
}
F diff --git a/php/upload.php b/php/upload.php
--- a/php/upload.php
+++ b/php/upload.php
<?php
require_once "database.php";
require_once "configuration.php";
+ require_once "file_type_recogniser.php";
session_start();
if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]))
$filename=$_POST["filename"];
$user=$_SESSION['user_object'];
$homedir=$user->home_directory;
+ $mimetype=file_type($file['tmp_name']);
- $codename=$database->create_file_node($filename,"",$homedir,$user);
+ $codename=$database->create_file_node($filename,"",$homedir,$mimetype,$user);
if($codename=="error")
{
error_log("could not create file_node in upload.php");