'application/pdf', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'html' => 'text/html', 'csv' => 'text/csv' ); header('Content-type: '.$mimetypes[$ext]); if($as_download == 'true') { header('Content-Disposition: attachment; filename=download_'.getmypid().time().'.'.$ext); } readfile($tempDir.$id.'.'.$ext); } ?>