mirror of
https://github.com/nokonoko/Uguu.git
synced 2024-01-06 13:35:15 +00:00
Update api.php
This commit is contained in:
parent
3ce12daea4
commit
362ed96d0d
17
api.php
17
api.php
@ -1,27 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
|
//If the value d doesn't exist, redirect back to front page *1
|
||||||
if(isset($_GET['d'])) {
|
if(isset($_GET['d'])) {
|
||||||
|
//Include the core file with the functions
|
||||||
include_once('core.php');
|
include_once('core.php');
|
||||||
switch ($_GET['d']) {
|
switch ($_GET['d']) {
|
||||||
|
|
||||||
case 'upload':
|
case 'upload':
|
||||||
|
//Set the name value to the original filename
|
||||||
$name = $_FILES['file']['name'];
|
$name = $_FILES['file']['name'];
|
||||||
|
//If the value name contains a custom name, set the name value
|
||||||
if(!empty($_POST['name'])){
|
if(!empty($_POST['name'])){
|
||||||
$name = $_POST['name'];}
|
$name = $_POST['name'];}
|
||||||
|
//Call the save function which sends the file+name
|
||||||
if(!empty($_POST['autoext'])){
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
save_file($_FILES['file']['tmp_name'], $name);
|
save_file($_FILES['file']['tmp_name'], $name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'extend-time':
|
case 'extend-time':
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
//If no correct valid argument for the api to perform on, tell them to enter a valid one
|
||||||
exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload');
|
exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
header('Location: http://uguu.se');
|
//*1
|
||||||
|
header('Location: index.html);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user