]> jfr.im git - uguu.git/commitdiff
Create api.php
authorEric Johansson (neku) <redacted>
Wed, 4 Feb 2015 19:21:50 +0000 (20:21 +0100)
committerEric Johansson (neku) <redacted>
Wed, 4 Feb 2015 19:21:50 +0000 (20:21 +0100)
api.php [new file with mode: 0644]

diff --git a/api.php b/api.php
new file mode 100644 (file)
index 0000000..9036270
--- /dev/null
+++ b/api.php
@@ -0,0 +1,23 @@
+<?php
+if(isset($_GET['d'])) {
+    include_once('core.php');
+    switch ($_GET['d']) {
+
+        case 'upload':
+
+            if(!empty($_POST['name'])){
+                save_file($_FILES["file"]["tmp_name"], $_POST['name']);
+            }else{
+                save_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
+            }
+            break;
+
+        case 'extend-time':
+            break;
+       default:
+       exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload');
+       break;
+    }
+}else{
+    exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload');
+}