]> jfr.im git - uguu.git/commitdiff
Update api.php
authorEric Johansson (neku) <redacted>
Tue, 10 Feb 2015 15:02:20 +0000 (16:02 +0100)
committerEric Johansson (neku) <redacted>
Tue, 10 Feb 2015 15:02:20 +0000 (16:02 +0100)
api.php

diff --git a/api.php b/api.php
index 3c24e7f2b1a9c8577136dcdaa91b2638c5eb7b5f..2f59766865f42711f545313548386fc30f4e4f1a 100644 (file)
--- a/api.php
+++ b/api.php
@@ -10,6 +10,11 @@ if(isset($_GET['d'])) {
        //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['originalname'])){
+        $name = $_FILES['file']['name'];}
+       //Remove any whitespace from name
+       $name = preg_replace('/\s+/', '', $name);
        //Call the save function which sends the file+name
        save_file($_FILES['file']['tmp_name'], $name);
        break;