aboutsummaryrefslogtreecommitdiffstats
path: root/php/upload.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/upload.php')
-rw-r--r--php/upload.php23
1 files changed, 11 insertions, 12 deletions
diff --git a/php/upload.php b/php/upload.php
index d9110c7..bd72b6b 100644
--- a/php/upload.php
+++ b/php/upload.php
@@ -1,22 +1,21 @@
<?php
+require_once "database.php"
+require_once "configuration.php"
-if (!array_key_exists('uf', $_FILES)) {
+if (!isset( $_POST["filename") || !isset($_POST["the_file"])
+{
http_response_code(400);
- exit();
+ error_log("someone tried to upload something impropperly");
+ exit(1);
}
-$file = $_FILES['uf'];
+$file = $_POST["the_file"];
+$filename= $_POST["filename"];
-if (file['error'] != 0) {
- http_response_code(400);
- exit();
-}
-
-$m = md5_file($file['tmp_name']);
-
-copy($file['tmp_name'], "screen/$m.png");
+$codename=create_file_node($filename);
-echo "http://india.fmi.fail/screen/$m.png";
+copy($file['tmp_name'], "$storage_root/$codename");
+echo $codename;
?>