function download_file($file){
if(is_file($file)){
$length = filesize($file);
$type = mime_content_type($file);
$showname = ltrim(strrchr($file,'/'),'/');
header("Content-Description: File Transfer");
header('Content-type: ' . $type);
header('Content-Length:' . $length);
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { //for IE
header('Content-Disposition: attachment; filename="' . rawurlencode($showname) . '"');
} else {
header('Content-Disposition: attachment; filename="' . $showname . '"');
}
readfile($file);
exit;
} else {
exit('文件已被删除!');
}
}
标签:
isp
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。