Update api.php

This commit is contained in:
Eric Johansson (neku) 2015-02-11 17:29:54 +01:00
parent 41b2390c28
commit 64c27042fc
1 changed files with 2 additions and 1 deletions

View File

@ -7,13 +7,14 @@ if(isset($_GET['d'])) {
case 'upload':
//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;