att_id=$att_id; $att->get(); //if ( intval($_SESSION["mem_id"])>0 || in_array($att_id,$PUBLIC_ATTACHMENTS) ){ if ( intval($_SESSION["mem_id"])>0 ){ if ($att->URI!=''){ //print_r($att); $path=$IN_MEDIA_DIR.$att->URI; if (filesize($path)>0){ $path_parts = pathinfo($path); $file_name=$att->title.".".$path_parts['extension']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $att->mime); header("Content-Length: " .(string)(filesize($path)) ); //header('Content-Disposition: attachment; filename="'.basename($path).'"'); header('Content-Disposition: attachment; filename="'.$file_name.'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); }else SendError("File Error!"); }else SendError("File not found!"); }else SendError("User needs to be logged in!"); ?>