PHP文件下载

<?php
	$fileName=$_GET['file'];
	header('Content-type:application/force-download');
	header('Content-Disposition:attachment;filename='.$fileName);
	
	$fp=fopen("文件目录".$fileName, "r");
	$content=fread($fp, filesize("文件目录".$fileName));
	echo $content;
?>

调用:
http://../frostbelt_download.php?file=download.jpg

  

posted @ 2011-08-25 15:39  xngeer  阅读(187)  评论(0编辑  收藏  举报