]>
jfr.im git - uguu.git/blob - api.php
89151bad6a5c406354c059705c1b282768592919
2 //If the value d doesn't exist, redirect back to front page *1
3 if(isset($_GET['d'])) {
4 //Include the core file with the functions
5 include_once('includes/core.php');
8 //If no file is being posted, show the error page and exit.
9 if(empty($_FILES['file']['name'])){
13 //Set the name value to the original filename
14 $name = $_FILES['file']['name'];
15 $arg = 'custom_original';
16 //If the value name contains a custom name, set the name value
17 if(!empty($_POST['name'])){
18 $name = $_POST['name'];}
19 //If value contains anything, keep original filename
20 if(!empty($_POST['randomname'])){
21 $name = $_FILES['file']['name'];
23 //Call the save function which sends the file+name
24 save_file($_FILES['file']['tmp_name'], $name, $arg);
29 //If no correct valid argument for the api to perform on, tell them to enter a valid one
30 exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload');
35 header('Location: index.html');