-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.php
44 lines (40 loc) · 1.24 KB
/
upload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
$secret_key = "secret-key"; //Set This As Your Secret Key So Only You Have Access (Basically A Password)
$sharexdir = "directory/"; // Must include / after folder name
$domain_url = 'https://abku.dev'; // Domain name, must include / after domain
//If You Dont Have A SSL Certificate Then Keep It As Http (000webhost Has A Free SSL Certificate)
$lengthofstring = 5; //Length Of The File You Will Upload's Name
function RandomString($length) {
$keys = array_merge(range(0,9), range('a', 'z'));
$key = '';
for($i=0; $i < $length; $i++) {
$key .= $keys[mt_rand(0, count($keys) - 1)];
}
return $key;
}
if(isset($_POST['secret']))
{
if($_POST['secret'] == $secret_key)
{
$filename = RandomString($lengthofstring);
$target_file = $_FILES["sharex"]["name"];
$fileType = pathinfo($target_file, PATHINFO_EXTENSION);
if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $sharexdir.$filename.'.'.$fileType))
{
echo $domain_url.$sharexdir.$filename.'.'.$fileType;
}
else
{
echo 'File Upload Failed - CHMOD/Folder Doesnt Exist';
}
}
else
{
echo 'Invalid Secret Key';
}
}
else
{
echo 'No Post Data Recieved';
}
?>