fix #341, 可以上传单独的附件

This commit is contained in:
wlx 2012-05-21 12:16:09 +00:00
parent edcb4e5404
commit e0ead8a31b
1 changed files with 3 additions and 3 deletions

View File

@ -1436,8 +1436,8 @@ class Admin_DataController extends Zend_Controller_Action
exit(); exit();
} }
$files=new files(); $files=new files();
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],'md'); $msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],empty($uuid)?'file':'md');
if(empty($msg['error'])) if(empty($msg['error']))
{ {
@ -1456,7 +1456,7 @@ class Admin_DataController extends Zend_Controller_Action
$msg['attid'] = $attid = $att['id']; $msg['attid'] = $attid = $att['id'];
$sql = "insert into mdattach (uuid,id) values ('$uuid','$attid')"; $sql = "insert into mdattach (uuid,id) values ('$uuid','$attid')";
if($this->db->exec($sql)) if(empty($uuid) || $this->db->exec($sql))
{ {
$msg['html'] = $realname.'['. round($filesize/1024,2) .' kb]<input type="hidden" name="atts[]" value="'.$attid.'" /><div class="cancel"><a href="javascript:;" id="deletebtn_'.$attid.'"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>'; $msg['html'] = $realname.'['. round($filesize/1024,2) .' kb]<input type="hidden" name="atts[]" value="'.$attid.'" /><div class="cancel"><a href="javascript:;" id="deletebtn_'.$attid.'"><img border="0" src="/static/js/uploadify/cancel.png" /></a></div>';
echo Zend_Json::encode($msg); echo Zend_Json::encode($msg);