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:
parent
35bc74300a
commit
924297975e
6
api.php
6
api.php
@ -6,7 +6,13 @@ if(isset($_GET['d'])) {
|
|||||||
case 'upload':
|
case 'upload':
|
||||||
|
|
||||||
if(!empty($_POST['name'])){
|
if(!empty($_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']);
|
save_file($_FILES["file"]["tmp_name"], $_POST['name']);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
save_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
|
save_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user