]> jfr.im git - uguu.git/blobdiff - api.php
Update core.php
[uguu.git] / api.php
diff --git a/api.php b/api.php
index c5ea316f7e982b72c2be443576ff93f5b1926e2f..89151bad6a5c406354c059705c1b282768592919 100644 (file)
--- a/api.php
+++ b/api.php
@@ -2,18 +2,24 @@
 //If the value d doesn't exist, redirect back to front page *1
 if(isset($_GET['d'])) {
     //Include the core file with the functions
-    include_once('core.php');
+    include_once('includes/core.php');
     switch ($_GET['d']) {
         case 'upload':
+        //If no file is being posted, show the error page and exit.
+        if(empty($_FILES['file']['name'])){
+               include('error.php');
+               exit(0);
+        }
         //Set the name value to the original filename
        $name = $_FILES['file']['name'];
+       $arg = 'custom_original';
        //If the value name contains a custom name, set the name value
        if(!empty($_POST['name'])){
        $name = $_POST['name'];}
        //If value contains anything, keep original filename
        if(!empty($_POST['randomname'])){
         $name = $_FILES['file']['name'];
-       $arg = 'rand';}
+       $arg = 'random';}
        //Call the save function which sends the file+name
        save_file($_FILES['file']['tmp_name'], $name, $arg);
        break;