]> jfr.im git - uguu.git/blob - core.php
81e1d5c59b5578ed8eb3c4d813248405a4d75db5
[uguu.git] / core.php
1 <?php
2 function save_file ($file, $name){
3 //Generate a random set of numbers to set in front of the filename
4 $rand_string = crc32(microtime(true).mt_rand(1000, 9000));
5 //Where to save
6 $path='/home/neku/www/files/';
7 //Remove any tags
8 $file_data=strip_tags($file);
9 //Put together the random string+filename
10 $file_name=$rand_string.'_'.$name;
11 //Move the file to the above location with said filename
12 move_uploaded_file($file_data,$path.$file_name);
13 //Return url+filename to the user
14 echo 'http://a.uguu.se/'.$file_name;
15 }
16 ?>