public function uploadPic($request, $response) { /*{{{*/ $thesisId = $request->thesisId; $file = $_FILES['file']; $user = $this->curOperatorUser; $filePath = ''; if ($file['error'] == 0) { $attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN); if ($attach instanceof Attachment) { $filePath = $attach->filePath; } } if ($filePath) { ThesisClient::getInstance()->modifyThesisPicurl($thesisId, $filePath); } $msg = '文章图片修改成功'; $url = $response->router->urlfor('thesis/modifypic', array('msg' => $msg, 'thesisId' => $thesisId)); $response->setRedirect($url); }
public function uploadPic($request, $response) { /*{{{*/ $paperId = $request->paperId; $type = empty($request->type) ? $request->type : ""; $file = $_FILES['file']; $user = $this->curOperatorUser; $filePath = ''; if ($file['error'] == 0) { $attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN); if ($attach instanceof Attachment) { $filePath = $attach->filePath; } } if ($filePath) { if (empty($type)) { PaperClient::getInstance()->modifyPaperPicurl($paperId, $filePath); } else { PaperClient::getInstance()->modifyPaperAdPicurl($paperId, $filePath); } } $msg = '专题图片修改成功'; $url = $response->router->urlfor('paper/modifypic', array('msg' => $msg, 'paperId' => $paperId, 'type' => $type)); $response->setRedirect($url); }
public function uploadAttachmentPost($request, $response) { /*{{{*/ $file = $_FILES['file']; $projectOperator = $this->myProjectOperator; $user = $projectOperator->user; $filePath = ''; if ($file['error'] == 0) { $attachment = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, 0, 'WxArticle'); if ($attachment instanceof Attachment) { WxMgrClient::getInstance()->modifyWxArticleAttachment($request->wxArticleId, $attachment->id); } } $response->setRedirect("/wxmgr/modifywxarticle?wxArticleId={$request->wxArticleId}&preMsg=" . urlencode('修改成功')); }
public function uploadPic($request, $response) { /*{{{*/ $articleId = $request->articleId; $file = $_FILES['file']; $user = $this->curOperatorUser; $filePath = ""; if ($file['error'] == 0) { $attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN); if ($attach instanceof Attachment) { $filePath = $attach->filePath; } } if ($filePath) { ArticleClient::getInstance()->modifyArticlePicUrl($articleId, $filePath, $user->id); } $msg = 'ндубм╪ф╛пч╦дЁи╧╕'; $url = $response->router->urlfor('article/modifypic', array('msg' => $msg, 'articleId' => $articleId)); $response->setRedirect($url); }