增加了评审附件下载时附件是否存在的判断(如果无判断用户下载的文件中显示ZF抛出的错误信息)

This commit is contained in:
Li Jianxuan 2011-11-14 02:54:10 +00:00
parent 379402092a
commit c9b4bda877
1 changed files with 15 additions and 14 deletions

View File

@ -444,6 +444,15 @@ class ReviewController extends Zend_Controller_Action
$fullPath = $this->view->config->upload.$row['filename']; $fullPath = $this->view->config->upload.$row['filename'];
if(!file_exists($fullPath))
{
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>错误提示!</title></head><body>文件读取出错,请稍后重试</body></html>';
exit();
}
$fsize = filesize($fullPath); $fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath); $path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]); $ext = strtolower($path_parts["extension"]);
@ -482,24 +491,16 @@ class ReviewController extends Zend_Controller_Action
}catch(Exception $e){ }catch(Exception $e){
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>错误提示!</title></head><body>文件读取出错,请稍后重试</body></html>';
<title>无标题文档</title> exit();
</head>
<body>文件读取出错,请稍后重试</body>
</html>';
} }
}else{ }else{
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>错误提示!</title></head><body>读取用户信息出错,请先登录再下载附件重试</body></html>';
<title>无标题文档</title> exit();
</head>
<body>读取用户信息出错,请先登录再下载附件重试</body>
</html>';
} }