2 require_once('config_tinybrowser.php');
\r
3 require_once('fns_tinybrowser.php');
\r
5 // Check session, if it exists
\r
6 if(session_id() != '')
\r
8 if(!isset($_SESSION[$tinybrowser['sessioncheck']])) { echo 'Error!'; exit; }
\r
11 // Check hash is correct (workaround for Flash session bug, to stop external form posting)
\r
12 if($_GET['obfuscate'] != md5($_SERVER['DOCUMENT_ROOT'].$tinybrowser['obfuscate'])) { echo 'Error!'; exit; }
\r
14 // Check and assign get variables
\r
15 if(isset($_GET['type'])) { $typenow = $_GET['type']; } else { echo 'Error!'; exit; }
\r
16 if(isset($_GET['folder'])) { $dest_folder = urldecode($_GET['folder']); } else { echo 'Error!'; exit; }
\r
18 // Check file extension isn't prohibited
\r
19 $nameparts = explode('.',$_FILES['Filedata']['name']);
\r
20 $ext = end($nameparts);
\r
22 if(!validateExtension($ext, $tinybrowser['prohibited'])) { echo 'Error!'; exit; }
\r
25 if ($_FILES['Filedata']['tmp_name'] && $_FILES['Filedata']['name'])
\r
27 $source_file = $_FILES['Filedata']['tmp_name'];
\r
28 $file_name = stripslashes($_FILES['Filedata']['name']);
\r
29 if($tinybrowser['cleanfilename']) $file_name = clean_filename($file_name);
\r
30 if(is_dir($tinybrowser['docroot'].$dest_folder))
\r
32 $success = copy($source_file,$tinybrowser['docroot'].$dest_folder.'/'.$file_name.'_');
\r
36 header('HTTP/1.1 200 OK'); // if this doesn't work for you, try header('HTTP/1.1 201 Created');
\r
37 ?><html><head><title>File Upload Success</title></head><body>File Upload Success</body></html><?php
\r