From b628f7502b6a96b10f0eb6a8c713c827447c8592 Mon Sep 17 00:00:00 2001 From: "Eric Johansson (neku)" Date: Tue, 10 Feb 2015 16:02:20 +0100 Subject: [PATCH] Update api.php --- api.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api.php b/api.php index 3c24e7f..2f59766 100644 --- 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;