1
0
mirror of https://github.com/nokonoko/Uguu.git synced 2024-01-06 13:35:15 +00:00

api.php - auto-append extension

Added paramater autoext to automatically append file extension to the name parameter supplied. (Useful for example in ShareX, if you want to have a custom filename, since you cannot supply the extension of the uploaded file in the uploader config.)
This commit is contained in:
Jim Bäckström 2015-02-07 18:18:17 +02:00
parent 35bc74300a
commit 924297975e

View File

@ -6,7 +6,13 @@ if(isset($_GET['d'])) {
case 'upload':
if(!empty($_POST['name'])){
save_file($_FILES["file"]["tmp_name"], $_POST['name']);
if(isset($_POST['autoext'])){
$oftheworld = explode(".", $_FILES["file"]["name"]);
$ext = end($oftheworld);
save_file($_FILES["file"]["tmp_name"], $_POST['name'] . $ext);
}else{
save_file($_FILES["file"]["tmp_name"], $_POST['name']);
}
}else{
save_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
}