'err','reason'=>'File not found'))); } else { $answer = getInfoAboutHash($hash); $answer['status'] = 'ok'; exit(json_encode($answer)); } function getInfoAboutHash($hash) { $file = getDataDir().DS.$hash.DS.$hash; if(!file_exists($file)) return array('status'=>'err','reason'=>'File not found'); $size = filesize($file); $size_hr = renderSize($size); $content_type = exec("file -bi " . escapeshellarg($file)); if($content_type && strpos($content_type,'/')!==false && strpos($content_type,';')!==false) { $type = $content_type; $c = explode(';',$type); $type = $c[0]; } return array('hash'=>$hash,'size_bytes'=>$size,'size_interpreted'=>$size_hr,'type'=>$type,'type_interpreted'=>getTypeOfFile($file)); }