在review中增加了文件大小的读取,方便用户选择下载

This commit is contained in:
Li Jianxuan 2011-11-08 07:18:46 +00:00
parent bd6877fab3
commit 25d7c7c499
1 changed files with 10 additions and 2 deletions

View File

@ -389,7 +389,7 @@ class ReviewController extends Zend_Controller_Action
</li>
';
$sql = "select att.realname,att.id from attachments att
$sql = "select att.realname,att.id,att.filesize from attachments att
left join mdreviewattach ratt on ratt.attachid = att.id
where ratt.reviewid = $rid";
@ -399,8 +399,16 @@ class ReviewController extends Zend_Controller_Action
foreach($rows as $k=>$v)
{
if($v['filesize'] > 1024*1024)
{
$v['filesize'] = round($v['filesize']/1024/1024,2) . "MB";
}
else
{
$v['filesize'] = round($v['filesize']/1024,2) . "KB";
}
$list[] = '
<li>'.$v['realname'].'
<li>'.$v['realname'].' &nbsp;('.$v['filesize'].')
<span><a href="/review/downatt/id/'.$v['id'].'">下载</a></span>
</li>
';