blob: b36a0f1bfb4c897375467de3e9531cbefa6d9246 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
require_once "database.php";
require_once "configuration.php";
session_start();
echo 1;
if (!isset( $_POST["filename"]) || !isset($_FILES["the_file"]))
{
error_log("someone tried to upload something impropperly");
http_response_code(400);
exit(1);
}
echo 2;
$file=$_FILES["the_file"];
$filename=$_POST["filename"];
$homedir=$_SESSION['user_object'];
echo 3;
$codename=$database->create_file_node($filename,"",$_SESSION['user_object']->home_directory);
echo $codename;
if($codename=="error")
{
error_log("could not create file_node in upload.php");
http_response_code(400);
exit(0);
}
move_uploaded_file($file['tmp_name'], "$storage_root/$codename");
http_response_code(200);
exit(0);
?>
|