当前位置: 首页>>代码示例>>PHP>>正文


PHP Uploader::file2attach方法代码示例

本文整理汇总了PHP中Uploader::file2attach方法的典型用法代码示例。如果您正苦于以下问题:PHP Uploader::file2attach方法的具体用法?PHP Uploader::file2attach怎么用?PHP Uploader::file2attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Uploader的用法示例。


在下文中一共展示了Uploader::file2attach方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uploadAttach

    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();
	}/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:11,代码来源:attachcontroller.php

示例2: upload

 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;
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:18,代码来源:spidercontroller.php

示例3: alert

    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;
}
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:31,代码来源:upload_json.php

示例4: doUploadAttach

 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;
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:21,代码来源:intentioncontroller.php

示例5: uploadAttachment

 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))));
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:19,代码来源:attachcontroller.php

示例6: attach2bingli

    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;
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:10,代码来源:attachcontroller.php

示例7: uploadAttachment

 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;
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:39,代码来源:projectcustomermgrcontroller.php

示例8: uploadAttach

 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;
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:12,代码来源:outpatienttoolcontroller.php

示例9: uploadAttach

 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();
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:24,代码来源:adminarticlecontroller.php


注:本文中的Uploader::file2attach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。