Debugged upload_data_file method unified for upload_data_file & add eventz and moved...
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / filez.inc
index a7fcd3943238e1abc73f0f3783461d187fd226f0..09bd11a37652709c1783c20bcdd3ea079ab792cd 100644 (file)
@@ -18,5 +18,19 @@ public static function upload_filename_secure($name){
        return true;
 }
 
+public static function upload_data_file($node_id) {
+       if ( !filez::upload_filename_secure($_FILES['data_file']['name'])) {
+               $error = 'bad, naughty file type. Cruise missile launched.';
+               return false;
+       }
+       if (!is_dir(FILE_DIR.$_SESSION['user_id'])) {
+                mkdir(FILE_DIR.$_SESSION['user_id']);
+       }
+       $suffix = array_pop(explode('.', basename($_FILES['data_file']['name'])));
+       copy($_FILES['data_file']['tmp_name'], FILE_DIR.$_SESSION['user_id'].'/'.$node_id.".$suffix");
+       symlink(FILE_DIR.$_SESSION['user_id'].'/'.$node_id.".$suffix",FILE_DIR.'/'.$node_id);
+
+}
+
 }
 ?>
This page took 0.104053 seconds and 4 git commands to generate.