aboutsummaryrefslogtreecommitdiffstats
path: root/php/database.php
diff options
context:
space:
mode:
authoradam <adam@>2021-02-12 12:38:09 +0200
committeradam <adam@>2021-02-12 12:38:09 +0200
commited66392fc694ffb10b59a22b9305c7334d13a67f (patch)
tree61ae21764fae86c28ac6f3a172df6904c6fce0ae /php/database.php
parent9102b9017d978be8c119a3ac8e79c661f2dad6b1 (diff)
downloadfileup-ed66392fc694ffb10b59a22b9305c7334d13a67f.tar.gz
upload prototype. needs to be checked
Diffstat (limited to 'php/database.php')
-rw-r--r--php/database.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/php/database.php b/php/database.php
index a46bdd2..cfef823 100644
--- a/php/database.php
+++ b/php/database.php
@@ -164,6 +164,27 @@ require_once "node.php";
//print count($id);
return $id[0];
}
+ /*returns the file name as it must be in the filesystem*/
+ function create_file_node(string $filename): string
+ {
+ global $storage_root;
+ $code=get_random_node_name("");
+ if($filename==NULL)return false;
+ $prep=$this->pdo->prepare("insert into nodes(is_directory,relative_path,name,code)
+ values(false,:root,:name,:code)
+ ");
+ $prep->bindParam(':name',$filename);
+ $prep->bindParam(':root',$storage_root);
+
+ $prep->bindParam(':code',$code);
+ if($prep->execute()==false)
+ {
+ error_log("could not upload file");
+ /*not so quiet error*/
+ return "error";
+ }
+ return code;
+ }
function are_linked(int $directory_id,int $node_id): bool
{
$prepare=$this->pdo->prepare("select node_id