X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=wwwroot%2Finc%2Ffilez.inc;h=09bd11a37652709c1783c20bcdd3ea079ab792cd;hb=387da281967a2415804f59c471d5c871baa61e83;hp=a7fcd3943238e1abc73f0f3783461d187fd226f0;hpb=233544e1f97c1115cbeb267ef9ec64e55d370cb5;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/inc/filez.inc b/wwwroot/inc/filez.inc index a7fcd39..09bd11a 100644 --- a/wwwroot/inc/filez.inc +++ b/wwwroot/inc/filez.inc @@ -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); + +} + } ?>