4,250
社区成员
发帖
与我相关
我的任务
分享function indexAction()
{
$file_dir = @$_POST["dir"]; //文件路径为当前目录
$file_name = @$_POST["file_name"]; //文件名
$file=$file_dir.$file_name;
//$file="/var/www/test11.txt";
$this->view->downfile = $file;
echo $this->view->render('download/download.phtml');
}
$file = $this->downfile;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
//$file = $this->downfile;
else{echo $file.'ssa';}$(function download(){
$(".fileds").live("click",(function(){
var file_name = $(this).find(".name").text();
var dir = $("#bottom").text();
$("#download").click(function(){
$.post("download/index",{dir:dir,file_name:file_name},function(result){
location.href="http://dms.com/download"; }
//alert(result)}
)
})
}))
})这么来的