Trustmaster |
|
---|---|
This piece of code checks file extension, runs cot_file_check() to check if file contents is secure and uses cot_safename() to generate safe filename for storage: $gd_supported = array('jpg', 'jpeg', 'png', 'gif'); $file_ext = strtolower(end(explode(".", $file['name']))); $fcheck = cot_file_check($file['tmp_name'], $file['name'], $file_ext); if(in_array($file_ext, $gd_supported) && $fcheck == 1) { $file['name']= cot_safename($file['name'], true); $filename_full = $usr['id'].'-'.strtolower($file['name']); May the Source be with you!
|