修改了uploadify 的http-error问题
This commit is contained in:
parent
8d40a45d1e
commit
45cfd597aa
|
@ -580,5 +580,58 @@ class ServiceController extends Zend_Controller_Action
|
||||||
$odf->setImage('thumb', 'http://test.westgis.ac.cn/service/thumb/uuid/'.$row['uuid']);
|
$odf->setImage('thumb', 'http://test.westgis.ac.cn/service/thumb/uuid/'.$row['uuid']);
|
||||||
$odf->exportAsAttachedFile($row['title'].'.odt');
|
$odf->exportAsAttachedFile($row['title'].'.odt');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uploadAction(){
|
||||||
|
$this->_helper->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
|
|
||||||
|
try{
|
||||||
|
$auth = Zend_Auth::getInstance();
|
||||||
|
if($auth->hasIdentity())
|
||||||
|
{
|
||||||
|
$user = $auth->getIdentity();
|
||||||
|
$userid = $user->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($userid)||!is_numeric($userid)){
|
||||||
|
$msg['error'] = "请先登录";
|
||||||
|
echo Zend_Json::encode($msg);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$files=new files();
|
||||||
|
$msg = $files -> upload($this->view->config->upload,$_FILES['Filedata'],'reviewatt');
|
||||||
|
|
||||||
|
if(empty($msg['error']))
|
||||||
|
{
|
||||||
|
$msg['error']="";
|
||||||
|
$filename = $msg['db_path'];
|
||||||
|
$filesize = $msg['file_size'];
|
||||||
|
$filedesc = $this->_request->getParam('filedesc');
|
||||||
|
$filetype = $this->_request->getParam('dir');
|
||||||
|
$realname = $msg['realname'];
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "insert into attachments (filename,filetype,filedesc,userid,filesize,realname) values ('$filename','reviewatt','$filedesc','$userid','$filesize','$realname') RETURNING id";
|
||||||
|
$sth = $this->db->prepare($sql);
|
||||||
|
$sth->execute();
|
||||||
|
$att = $sth->fetch(PDO::FETCH_ASSOC);
|
||||||
|
$msg['attid'] = $attid = $att['id'];
|
||||||
|
$msg['html'] = $realname.'[已完成]<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);
|
||||||
|
exit();
|
||||||
|
}else{
|
||||||
|
$msg['error'] = '附件上传失败:'.$msg['error'];
|
||||||
|
@unlink($filename);
|
||||||
|
echo Zend_Json::encode($msg);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception $e){
|
||||||
|
$msg['error'] = "错误:".$e->getMessage();
|
||||||
|
echo Zend_Json::encode($msg);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,7 +189,7 @@ $(document).ready(function() {
|
||||||
$('#file_upload').uploadify({
|
$('#file_upload').uploadify({
|
||||||
'uploader' : '/static/js/uploadify/uploadify.swf',
|
'uploader' : '/static/js/uploadify/uploadify.swf',
|
||||||
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>'},
|
'scriptData': {'PHPSESSID' : '<?php echo session_id(); ?>'},
|
||||||
'script' : '/upload',
|
'script' : '/service/upload',
|
||||||
'cancelImg' : '/static/js/uploadify/cancel.png',
|
'cancelImg' : '/static/js/uploadify/cancel.png',
|
||||||
'folder' : '/uploads',
|
'folder' : '/uploads',
|
||||||
'multi' : false,
|
'multi' : false,
|
||||||
|
|
Loading…
Reference in New Issue