FILEUP



LOG | FILES | OVERVIEW


F diff --git a/loggedin.js b/loggedin.js --- a/loggedin.js +++ b/loggedin.js
files = [];
var json = JSON.parse(this.responseText);
+ console.log(json);
for (const f of json) {
- add_file_visuals(f.name, f.is_directory, f.mimetype);
+ add_file_visuals(f.name, f.is_directory && f.is_directory != "0", f.mimetype);
}
};
xhr.send(data);
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,string $mimetype,User $user): string
+ function create_file_node(string $filename,string $note,int $dir_id,User $user): string
{
global $storage_root;
/*checkout the directory*/
/*generate the node*/
$code=$this->get_random_node_name("");
if($filename==NULL)return "error";
- $prep=$this->pdo->prepare("insert into nodes(is_directory,relative_path,code,type)
- values(false,:root,:code,:type)
+ $prep=$this->pdo->prepare("insert into nodes(is_directory,relative_path,code)
+ values(false,:root,:code)
");
$prep->bindParam(':root',$code);
$prep->bindParam(':code',$code);
- $prep->bindParam(':type',$mimetype);
if($prep->execute()==false)
{
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,$mimetype,$user);
+ $codename=$database->create_file_node($filename,"",$homedir,$user);
if($codename=="error")
{
error_log("could not create file_node in upload.php");