]>
Commit | Line | Data |
---|---|---|
78b2d83e | 1 | <?php |
362ed96d | 2 | //If the value d doesn't exist, redirect back to front page *1 |
78b2d83e | 3 | if(isset($_GET['d'])) { |
362ed96d | 4 | //Include the core file with the functions |
78b2d83e GJ |
5 | include_once('core.php'); |
6 | switch ($_GET['d']) { | |
78b2d83e | 7 | case 'upload': |
362ed96d | 8 | //Set the name value to the original filename |
f6de5bc0 | 9 | $name = $_FILES['file']['name']; |
362ed96d | 10 | //If the value name contains a custom name, set the name value |
f6de5bc0 | 11 | if(!empty($_POST['name'])){ |
ff3c1102 | 12 | $name = $_POST['name'];} |
b628f750 | 13 | //If value contains anything, keep original filename |
0f429b06 GJ |
14 | if(!empty($_POST['randomname'])){ |
15 | $name = $_FILES['file']['name']; | |
16 | $arg = 'rand';} | |
362ed96d | 17 | //Call the save function which sends the file+name |
0f429b06 | 18 | save_file($_FILES['file']['tmp_name'], $name, $arg); |
f6de5bc0 | 19 | break; |
78b2d83e GJ |
20 | case 'extend-time': |
21 | break; | |
22 | default: | |
362ed96d | 23 | //If no correct valid argument for the api to perform on, tell them to enter a valid one |
78b2d83e GJ |
24 | exit('Please provide a valid argument. Example: curl -i -F name=test.jpg -F file=@localfile.jpg http://uguu.se/api.php?d=upload'); |
25 | break; | |
26 | } | |
27 | }else{ | |
362ed96d | 28 | //*1 |
6e46f9b0 | 29 | header('Location: index.html'); |
78b2d83e | 30 | } |