$disposition = isImg($attachmentpath) ? 'inline' : 'attachment'; $db_charset == 'utf-8' && $attdata['filename'] = convert_encoding('utf-8', 'gbk', $attdata['filename']); strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE && $attdata['filename'] = urlencode($attdata['filename']); header('Cache-control: max-age=31536000'); header('Expires: '.gmdate('D, d M Y H:i:s', $timestamp + 31536000).' GMT'); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $attdata['uploaddate']).' GMT'); header('Content-type: '.$attdata['filetype']); header('Content-Encoding: none'); header('Content-Disposition: '.$disposition.'; filename='.$attdata['filename']); header('Content-Length: '.filesize($attachmentpath)); header('Content-Transfer-Encoding: binary'); @readfile($attachmentpath);