最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

txt pdf 等浏览器不直接打开下载程序

运维笔记admin1浏览0评论
$sava_name = '/uploadfile/2014/0726/20140726114913835.txt';
header("Content-Type: application/force-download");
header("Content-Transfer-Encoding: binary");
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename='.$sava_name);

readfile($sava_name);



case "jpg":
		case "jpeg": $ctype="image/jpeg"; break;
		case "pdf": $ctype="application/pdf"; break;		
		case "gif": $ctype="image/gif"; break;	
		case "png": $ctype="image/png"; break;
		case "doc": $ctype="application/msword"; break;	
		case "zip":	$ctype="application/zip";break;	
		case "rar":	$ctype="application/rar";	break;	
		case "mp3":	$ctype="audio/mpeg3";	break;	
		case "avi":	$ctype="video/avi";	break;	
		case "doc":	$ctype="application/msword";break;	
		case "xls":	$ctype="application/vnd.ms-excel";	break;		
		case "wav":	$ctype="audio/wav";	break;	
		case "html":
		case "htm": $ctype="text/html";	break;	
		case "txt":	$ctype="text/plain";	break;
		case "flv":	$ctype="flv-application/octet-stream";	break;
		case "mp4":	$ctype="video/mp4";	break;		  
		default: $ctype="application/force-download"; //$ctype="application/octet-stream";

发布评论

评论列表(0)

  1. 暂无评论