コード例 #1
0
    public function uploadAttach($request, $response)
    {/*{{{*/
        $source = $request->getRequest('source', self::UPLOAD_SOURCE_MUTI);
        $file = $this->getFile($source);
        if ($file['error']==0)
        {
            $attach = Uploader::file2attach($this->user, $file);
            echo $this->getTemplate($source, $attach);
		}
        exit();
	}/*}}}*/
コード例 #2
0
 public function upload($request, $response)
 {
     /*{{{*/
     $file = $_FILES['file'];
     $user = $this->curOperatorUser;
     if ($file['error'] == 0) {
         //modify by wzl,CMS-908
         //$attach = Uploader::imageFile2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN);
         $type = TuClient::getInstance()->getSuffix($file['name']);
         $attach = Uploader::file2attach($user, $file, $type, $user->id, Attachment::HOSTTYPE_HDFADMIN);
         //end modify by wzl,CMS-908
         if ($attach instanceof Attachment) {
             echo Attachment::getJson(array($attach), Attachment::THUMBNAIL_WIDTH_HDFADMIN, Attachment::THUMBNAIL_HIGHT_HDFADMIN);
         }
         exit;
     }
     exit;
 }
コード例 #3
0
    if (@is_uploaded_file($file['tmp_name']) === false) {
        alert("上传失败。");
    }
    //检查文件大小
    if ($file['size'] > $max_size) {
        alert("上传文件大小超过限制。");
    }
    //获得文件扩展名
    $temp_arr = explode(".", $file_name);
    $file_ext = array_pop($temp_arr);
    $file_ext = trim($file_ext);
    $file_ext = strtolower($file_ext);
    //检查扩展名
    if (in_array($file_ext, $ext_arr[$dir_name]) === false) {
        alert("上传文件扩展名是不允许的扩展名。\n只允许" . implode(",", $ext_arr[$dir_name]) . "格式。");
    }
    $user = $curOperatorUser;
    $attach = Uploader::file2attach($user, $file, Attachment::TYPE_JPG, $user->id, Attachment::HOSTTYPE_HDFADMIN);
    $file_url = TuClient::getInstance()->getUrl($attach->filePath);
    header('Content-type: text/html; charset=UTF-8');
    $json = new Services_JSON();
    echo $json->encode(array('error' => 0, 'url' => $file_url));
    exit;
}
function alert($msg)
{
    header('Content-type: text/html; charset=GBK');
    $json = new Services_JSON();
    echo $json->encode(array('error' => 1, 'message' => $msg));
    exit;
}
コード例 #4
0
 public function doUploadAttach($request, $response)
 {
     /*{{{*/
     $patient = DAL::get()->mustFind('Patient', $request->patientid);
     $file = $_FILES['attach'];
     if (0 == $file['error']) {
         $attach = Uploader::file2attach($patient->user, $file);
         $hospitalDtoId = 0;
         $hospitalName = $request->hospitalName;
         $facultyName = $request->facultyName;
         if (false == empty($hospitalName) || false == empty($facultyName)) {
             $hospitalDto = BingLiDto::createHospitalDto($hospitalName, $facultyName, $patient->id);
             $hospitalDtoId = NodeClient::getInstance()->addBingLi($hospitalDto, NodeObj::SOURCE_PATIENT);
         }
         $pa = BingLiClient::getInstance()->addBingLi($patient->user->id, $patient->id, '', PatientAttachment::TYPE_PIC, 0, '', $request->checkTime, $attach->id, $hospitalName, $facultyName, $request->itemName, $hospitalDtoId);
         $obj = DAL::get()->find($request->objname, $request->objid);
         $this->bindAttachBingliByPaIds($patient, array($pa->id), $obj);
     }
     echo "<script>parent.\$.fancybox.close();parent.document.location.reload();</script>";
     return parent::DIRECT_OUTPUT;
 }
コード例 #5
0
 public function uploadAttachment($request, $response)
 {/*{{{*/
     $source = $request->getRequest('source', self::UPLOAD_SOURCE_MUTI);
     $file = $this->getFile($source);
     $bingLi = NullEntity::create();
     if ($file['error']==0 && $this->user instanceof User)
     {
         $attach = Uploader::file2attach($this->user, $file);
         $patientId = $request->patientId;
         $bingLi = $this->attach2bingli($attach, $patientId);
     }
     $attachIds = explode(",", $request->attachIds);
     $attachIds[] = $bingLi->id;
     if($bingLi->isNull())
     {
         $response->msg = "上传文件失败";
     }
     $response->setRedirect($response->router->urlfor('attach/uploadattach4signin', array('patientId' => $request->patientId, 'spaceId' => $request->spaceId, 'attachIds' => implode(',', $attachIds))));
 }/*}}}*/
コード例 #6
0
    private function attach2bingli($patientId, $file)
    {/*{{{*/
        $patient = DAL::get()->find('Patient', $patientId);
        DBC::requireTrue(false == $this->_newUser->isNull(), 'user 不能为空');
        $user = $patient->isNull()? $this->_newUser: $patient->user;
        $attach = Uploader::file2attach($user, $file);
        $pa = BingLiClient::getInstance()->addBingLi($user->id, $patient->id, '', PatientAttachment::TYPE_PIC, 0, '', '', $attach->id);

        return $pa;
    }/*}}}*/
コード例 #7
0
 public function uploadAttachment($request, $response)
 {
     /*{{{*/
     $file = $_FILES['file'];
     $projectOperator = $this->myProjectOperator;
     $followupCustomer = DAL::get()->find("FollowupCustomer", $request->followupCustomerId);
     $user = $followupCustomer->getBindUser();
     $receivetime = $request->receivetime;
     $content = $request->content;
     //        $file['name'] = $content;
     $description = "接收时间:{$receivetime};<br/>资料内容:{$content}";
     $projectInterviewId = $request->projectInterviewId;
     if (isset($projectInterviewId)) {
         $projectInterview = DAL::get()->find("ProjectInterview", $projectInterviewId);
         if (false == $projectInterview instanceof ProjectInterview) {
             throw new BizException("没有找到该次访视!");
         }
         $sourceId = $projectInterview->id;
         $sourceType = get_class($projectInterview);
     } else {
         $sourceId = $followupCustomer->id;
         $sourceType = get_class($followupCustomer);
     }
     $filePath = '';
     $type = $request->type;
     if ($file['error'] == 0) {
         $suffixName = TuClient::getInstance()->getSuffix($file['name']);
         $attach = Uploader::file2attach($user, $file, $suffixName, $sourceId, $sourceType);
         if ($attach instanceof Attachment) {
             $filePath = $attach->filePath;
         }
         AttachClient::getInstance()->modifyDescription($attach->id, $description);
         ProjectInterviewLogClient::getInstance()->addLog($projectOperator->id, $request->projectInterviewId, '接收资料', $content);
         echo "<div style='margin:60px auto auto 140px;'> 上传成功! </div>";
     } else {
         echo "<div style='margin:60px auto auto 140px;'> 上传失败! </div>";
     }
     return parent::DIRECT_OUTPUT;
 }
コード例 #8
0
 public function uploadAttach($request, $response)
 {
     /*{{{*/
     $source = $request->getRequest('source', self::UPLOAD_SOURCE_MUTI);
     $file = $this->getFile($source);
     $user = DAL::get()->find("user", $request->userId);
     if ($file['error'] == 0 && $user instanceof User) {
         $attach = Uploader::file2attach($user, $file);
         echo "{" . $attach->id . "}";
     }
     exit;
 }
コード例 #9
0
 public function uploadAttach($request, $response)
 {/*{{{*/
     $info = array('message' => 'file_error!=0', 'id' => 0);
     $file = $_FILES['file'];
     if ($file['error']==0)
     {
         $attach = Uploader::file2attach($this->_newSpace->user, $file, Attachment::TYPE_DOC, $this->_newSpace->user->id, Attachment::HOSTTYPE_ARTICLE);
         if($attach instanceof Attachment)
         {
             $legalName = mb_convert_encoding($attach->fileName, 'utf-8', 'gbk');
             $info = array('name' => $legalName, 'id' => $attach->id);
         }
         else
         {
             $info = array('message' => "服务器忙,请稍后再试。", 'id' => 0);
         }
     }
     else
     {
         $info = array('message' => "服务器繁忙,请稍后再试。", 'id' => 0);
     }
     echo json_encode($info);
     exit();
 }/*}}}*/