· 7 years ago · Dec 29, 2018, 07:48 AM
1<?php
2
3$secret_key = "9ge9ag99135213tgedavxgfedsabcd"; //Set this as your secret key, to prevent others uploading to your server.
4$sharexdir = "i/"; //This is your file dir, also the link..
5$domain_url = 'http://frizzy.xyz/';
6$lengthofstring = 5; //Length of the file name
7$key = "";
8
9function RandomString($length) {
10 $keys = array_merge(range(0,9), range('a', 'z'));
11
12 for ($i=0; $i < $length; $i++) {
13 $key .= $keys[mt_rand(0, count($keys) - 1)];
14 }
15 return $key;
16}
17
18if(isset($_POST['secret']))
19{
20 if($_POST['secret'] == $secret_key)
21 {
22 $filename = RandomString($lengthofstring);
23 $target_file = $_FILES["sharex"]["name"];
24 $fileType = pathinfo($target_file, PATHINFO_EXTENSION);
25
26 if (move_uploaded_file($_FILES["sharex"]["tmp_name"], $sharexdir.$filename.'.'.$fileType))
27 {
28 echo $domain_url.$sharexdir.$filename.'.'.$fileType;
29 }
30 else
31 {
32 echo 'File upload failed - CHMOD/Folder doesn\'t exist?';
33 }
34 }
35 else
36 {
37 echo 'Invalid Secret Key';
38 }
39}
40else
41{
42 echo 'No post data recieved';
43}
44?>