增加了review中附件下载功能,修改了上传列队的数量限制,修改了单个文件大小限制

This commit is contained in:
Li Jianxuan 2011-11-08 07:09:23 +00:00
parent b8d245fcd5
commit bd6877fab3
2 changed files with 55 additions and 1 deletions

View File

@ -313,7 +313,7 @@ class ReviewController extends Zend_Controller_Action
$sth = $this->db->prepare($sql);
if($sth->execute())
{
if($_POST['atts'])
if(isset($_POST['atts']))
{
$review = $sth->fetch(PDO::FETCH_ASSOC);
$reviewid=$review['id'];
@ -415,6 +415,58 @@ class ReviewController extends Zend_Controller_Action
exit();
}// ajax 评审附件列表
function downattAction(){
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_request->getParam('id');
$sql = "select * from attachments where id='$id'";
$re = $this->db->query($sql);
$row = $re->fetch();
$file = new files();
$fullPath = $this->view->config->upload.$row['filename'];
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
switch ($ext) {
case "pdf": $ctype="application/pdf"; break;
case "exe": $ctype="application/octet-stream"; break;
case "zip": $ctype="application/zip"; break;
case "doc": $ctype="application/msword"; break;
case "xls": $ctype="application/vnd.ms-excel"; break;
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
case "gif": $ctype="image/gif"; break;
case "png": $ctype="image/png"; break;
case "jpeg":
case "jpg": $ctype="image/jpg"; break;
default: $ctype="application/force-download";
}
$content=file_get_contents($fullPath);
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="'.basename($fullPath).'"')
->setHeader('Content-Length', $fsize)
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Type',$ctype)
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($content);
}// downattAction 下载附件
}

View File

@ -207,6 +207,8 @@ $(document).ready(function() {
'script' : '/service/upload',
'cancelImg' : '/static/js/uploadify/cancel.png',
'folder' : '/uploads',
'sizeLimit' : 10485760,
'queueSizeLimit' : 10,
'multi' : true,
'auto' : false,
'displayData' : 'speed',