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


PHP UploadFile::getUploadFileInfo方法代码示例

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


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

示例1: localupload

	public function localupload(){
		$upload = new UploadFile();
		$upload->allowExts  = array('pem');
		//覆盖同名的文件
		$upload->uploadReplace=1;
        $firstLetter=substr($this->token,0,1);
        $upload->savePath =  './uploads/'.$firstLetter.'/'.$this->token.'/';// 设置附件上传目录
        //
        if (!file_exists($_SERVER['DOCUMENT_ROOT'].'/uploads')||!is_dir($_SERVER['DOCUMENT_ROOT'].'/uploads')){
            mkdir($_SERVER['DOCUMENT_ROOT'].'/uploads',0777);
        }
        $firstLetterDir=$_SERVER['DOCUMENT_ROOT'].'/uploads/'.$firstLetter;
        if (!file_exists($firstLetterDir)||!is_dir($firstLetterDir)){
            mkdir($firstLetterDir,0777);
        }
        if (!file_exists($firstLetterDir.'/'.$this->token)||!is_dir($firstLetterDir.'/'.$this->token)){
            mkdir($firstLetterDir.'/'.$this->token,0777);
        }
		if(!file_exists($upload->savePath)||!is_dir($upload->savePath)){
			mkdir($upload->savePath,0777);
		}
       // $upload->hashLevel=2;
        if(!$upload->upload()) {// 上传错误提示错误信息
            $error=1;
            $msg=$upload->getErrorMsg();
			$this->error($msg);exit;
        }else{// 上传成功 获取上传文件信息
            $error=0;
            $info =  $upload->getUploadFileInfo();
            $this->siteUrl=$this->siteUrl?$this->siteUrl:C('site_url');
			$msg=$this->siteUrl.substr($upload->savePath,1).$info[0]['savename'];
			//成功入库
			$this->addCert($info[0]['key'],$msg);
        }
	}
开发者ID:kevicki,项目名称:pig,代码行数:35,代码来源:Alipay_certAction.class.php

示例2: index

 public function index()
 {
     @header("Content-Type:text/html; charset=utf-8");
     import('ORG.Net.UploadFile');
     $upload = new UploadFile();
     // 实例化上传类
     $upload->maxSize = 3145728;
     // 设置附件上传大小
     $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg');
     // 设置附件上传类型
     $savepath = '../uploads/' . date('Ymd') . '/';
     $savepath1 = '/uploads/' . date('Ymd') . '/';
     if (!file_exists($savepath)) {
         mkdir($savepath);
     }
     $upload->savePath = $savepath;
     // 设置附件上传目录
     if (!$upload->upload()) {
         // 上传错误提示错误信息
         $this->error($upload->getErrorMsg());
     } else {
         // 上传成功 获取上传文件信息
         $info = $upload->getUploadFileInfo();
     }
     print_r($savepath1 . $info[0]['savename']);
 }
开发者ID:nathan1217,项目名称:ccad,代码行数:26,代码来源:UploadAction.class.php

示例3: uploadimg

 public function uploadimg()
 {
     import('CloudUploadFile');
     //上传处理类
     $config = array('allowExts' => array('jpg', 'gif', 'png'), 'savePath' => './' . C("UPLOADPATH") . "ueditor/", 'maxSize' => 11048576, 'saveRule' => 'uniqid');
     $upload = new UploadFile($config);
     $file = $title = $oriName = $state = '0';
     //开始上传
     if ($upload->upload()) {
         //上传成功
         $info = $upload->getUploadFileInfo();
         $title = $oriName = $info[0]['name'];
         $state = 'SUCCESS';
         $file = C("TMPL_PARSE_STRING.__UPLOAD__") . "ueditor/" . $info[0]['savename'];
         if (strpos($file, "https") === 0 || strpos($file, "http") === 0) {
         } else {
             //local
             $host = (is_ssl() ? 'https' : 'http') . "://" . $_SERVER['HTTP_HOST'];
             $file = $host . $file;
         }
     } else {
         $state = $upload->getErrorMsg();
     }
     echo "{'url':'" . $file . "','title':'" . $title . "','original':'" . $oriName . "','state':'" . $state . "'}";
 }
开发者ID:Nightchen0521,项目名称:cmf,代码行数:25,代码来源:UeditorAction.class.php

示例4: _upload

 protected function _upload()
 {
     //$tempFile = $_FILES['Filedata']['tmp_name'];
     //$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
     //$name = date('YmdHis')."_".rand(1000,9999).'.'.getExt($_FILES['Filedata']['name']);
     //$targetFile =  str_replace('//','/',$targetPath) . $name;
     //move_uploaded_file($tempFile,$targetFile);
     //$_REQUEST['folder']."/$name ";
     import('@.FILE.UploadFile');
     //导入上传类
     $upload = new UploadFile();
     //设置上传文件大小
     $upload->maxSize = 3292200;
     //设置上传文件类型
     $upload->allowExts = explode(',', 'jpg,gif,png,jpeg,bmp,JPG,GIF,PNG,JPEG,BMP');
     //设置附件上传目录
     $upload->savePath = './Uploads/' . $_GET['wjj'] . '/';
     //设置需要生成缩略图,仅对图像文件有效
     $upload->thumb = true;
     // 设置引用图片类库包路径
     $upload->imageClassPath = '@.ORG.Image';
     //设置需要生成缩略图的文件后缀
     $upload->thumbPrefix = 'm_,s_';
     //生产2张缩略图
     //设置缩略图最大宽度
     $upload->thumbMaxWidth = '400,100';
     //设置缩略图最大高度
     $upload->thumbMaxHeight = '400,100';
     //设置上传文件规则
     $upload->saveRule = 'uniqid';
     //删除原图
     $upload->thumbRemoveOrigin = false;
     if (!$upload->upload()) {
         //捕获上传异常
         //$this->error($upload->getErrorMsg());
         echo '0';
     } else {
         //取得成功上传的文件信息
         $uploadList = $upload->getUploadFileInfo();
         import('@.ORG.Image');
         //给m_缩略图添加水印, Image::water('原文件名','水印图片地址')
         //Image::water($uploadList[0]['savepath'] . 'm_'.$uploadList[0]['savename'], C('PUBLIC').'/IMG/water.png');
         //水印必须在本项目里找
         //要去掉水印,你懂的//Image::water($uploadList[0]['savepath'] . 'm_'.$uploadList[0]['savename'], APP_PATH.'lib/ORG/logo.png');
         $_POST['image'] = $uploadList[0]['savename'];
         //$info=$upload->getUploadFileInfo();
         //$src=$uploadList[0]['savepath'].'s_'.$uploadList[0]['savename'];
         //$src=$uploadList[0]['savepath'].''.$uploadList[0]['savename'];//原图
         //$src='m_'.$uploadList[0]['savename'];//原图名称
         if ($_GET['issml'] == 'y') {
             $src = 'm_' . $uploadList[0]['savename'];
             //原图名称
         } else {
             $src = $uploadList[0]['savename'];
             //原图名称
         }
         echo $src;
         //$this->success('上传图片成功!');
     }
 }
开发者ID:PaulSunbinovic,项目名称:xx,代码行数:60,代码来源:FileUploadAction.class.php

示例5: add

 public function add()
 {
     import('ORG.Net.UploadFile');
     $upload = new UploadFile();
     // 实例化上传类
     $upload->maxSize = -1;
     // 设置附件上传大小
     $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg');
     // 设置附件上传类型
     $upload->savePath = './Public/Uploads/';
     // 设置附件上传目录
     if (!$upload->upload()) {
         // 上传错误提示错误信息
         $this->error($upload->getErrorMsg());
     } else {
         // 上传成功 获取上传文件信息
         $info = $upload->getUploadFileInfo();
     }
     // 保存表单数据 包括附件数据
     $add = array('username' => $_POST['username'], 'password' => $_POST['password'], 'cname' => $_POST['cname'], 'caddress' => $_POST['caddress'], 'cnature' => $_POST['cnature'], 'cindustry' => $_POST['cindustry'], 'chead' => $_POST['chead'], 'cphone' => $_POST['cphone'], 'email' => $_POST['email'], 'remark' => '1', 'img' => $info[0]['savename'], 'class' => '0');
     if (M('user')->add($add)) {
         $this->success('添加成功', U(GROUP_NAME . '/Login/index'));
     } else {
         $this->error('添加失败');
     }
 }
开发者ID:omusico,项目名称:Thinkphp_RMS,代码行数:26,代码来源:RegisterAction.class.php

示例6: upload

 public function upload()
 {
     import('ORG.Net.UploadFile');
     $upload = new UploadFile();
     // 实例化上传类
     $upload->maxSize = 3145728;
     // 设置附件上传大小
     $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg');
     // 设置附件上传类型
     $upload->savePath = '__ROOT__/Pic/';
     // 设置附件上传目录
     if (!$upload->upload()) {
         // 上传错误提示错误信息
         $this->error($upload->getErrorMsg());
     } else {
         // 上传成功 获取上传文件信息
         $info = $upload->getUploadFileInfo();
     }
     // 保存表单数据 包括附件数据
     $User = M("User");
     // 实例化User对象
     $User->create();
     // 创建数据对象
     $User->photo = $info[0]['savename'];
     // 保存上传的照片根据需要自行组装
     $User->add();
     // 写入用户数据到数据库
     $this->success('数据保存成功!');
 }
开发者ID:ppxj,项目名称:blsanda,代码行数:29,代码来源:PublicAction.class.php

示例7: upload

 public function upload()
 {
     //导入文件上传的封装类
     import("ORG.Net.UploadFile");
     //实例化封装类
     $upload = new UploadFile();
     $upload->maxSize = 10000000;
     //最大上传文件的大小
     $upload->allowExts = array("jpg", "png", "gif", "rar", "php", "zip");
     //允许上传文件的扩展名
     $upload->savePath = "public/upfile/";
     //保存路径
     //上传
     if ($upload->upload()) {
         //上传成功
         $arr = $upload->getUploadFileInfo();
         //上传的文件的相关信息
         print_r($arr);
     } else {
         //上传失败
         $msg = $upload->getErrorMsg();
         //获得上传的错误信息
         $this->success("{$msg}!", "Upload/index");
     }
 }
开发者ID:denson7,项目名称:phpstudy,代码行数:25,代码来源:UploadAction.class.php

示例8: up

 function up()
 {
     import('@.Org.UploadFile');
     $this->getSafeName($_FILES['file']['name']);
     $upload = new UploadFile();
     $upload->maxSize = '3000000';
     //是指上传文件的大小,默认为-1,不限制上传文件大小bytes
     $upload->savePath = './Public/images/';
     //上传保存到什么地方?路径建议大家已主文件平级目录或者平级目录的子目录来保存
     $upload->saveRule = "logo";
     //上传文件的文件名保存规则  time uniqid  com_create_guid  uniqid
     $upload->uploadReplace = true;
     //如果存在同名文件是否进行覆盖
     $upload->allowExts = array('gif');
     //准许上传的文件后缀
     $upload->allowTypes = array('image/gif');
     $upload->thumb = true;
     //是否开启图片文件缩略
     $upload->thumbMaxWidth = '210';
     //以字串格式来传,如果你希望有多个,那就在此处,用,分格,写上多个最大宽
     $upload->thumbMaxHeight = '82';
     //最大高度
     $upload->thumbPrefix = 'kshop_';
     //缩略图文件前缀
     $upload->thumbRemoveOrigin = 1;
     //如果生成缩略图,是否删除原图
     if ($upload->upload()) {
         $info = $upload->getUploadFileInfo();
         return $info;
     } else {
         $this->error($upload->getErrorMsg());
     }
 }
开发者ID:xuping123,项目名称:kshop,代码行数:33,代码来源:ShopsetAction.class.php

示例9: save

 public function save($act = NULL, $mode = 'Kindeditor')
 {
     //main
     import('ORG.Net.FileSystem');
     //实例化文件系统类
     $sys = new FileSystem();
     import('ORG.Net.UploadFile');
     //实例化上传类
     $up = new UploadFile();
     $up->allowTypes = array('image/pjpeg', 'image/jpeg', 'image/x-png', 'image/png', 'image/gif');
     $upload = C('TMPL_PARSE_STRING.__UPLOAD__');
     $up->savePath = ROOT . '/' . $upload . '/';
     $up->maxSize = C('UPLOAD_SIZE');
     $up->charset = 'UTF-8';
     $up->autoSub = true;
     if ($up->upload()) {
         $info = $up->getUploadFileInfo();
         $upfile = M('Upload_file');
         $udata = array('ModeName' => $mode, 'BelongFile' => $act, 'FileName' => $info[0]['savename'], 'CreateDate' => date("Y-m-d", time()));
         $add = $upfile->add($udata);
         $data = array('error' => 0, 'message' => "图片上传成功", 'url' => C('CFG_HOST') . "/" . $upload . "/" . $info[0]['savename']);
         echo json_encode($data);
         unset($info, $upfile, $data, $udata);
     } else {
         $info = $up->getErrorMsg();
         echo '{"error" : 1, "message" : "' . $info . '" }';
     }
     unset($sys, $up, $upload);
 }
开发者ID:huangchuping,项目名称:bug,代码行数:29,代码来源:UploadAction.class.php

示例10: addvedio

 public function addvedio()
 {
     $zhang_id = $_POST['zhang_id'];
     $vedio_title = $_POST['vedio_title'];
     $course_id = $_POST['course_id'];
     $upload = new UploadFile($_POST['file']);
     $upload->allowExts = array('mp4');
     $upload->savePath = './../Public/Uploads/vedio/';
     if (!$upload->upload()) {
         $this->error($upload->getErrorMsg());
     } else {
         $info = $upload->getUploadFileInfo();
         $vedio = M('vedio');
         $vedio->create();
         $vedio->vedio_title = $vedio_title;
         $vedio->vedio_name = $info[0]['savename'];
         $vedio->zhang_id = $zhang_id;
         $result = $vedio->add();
         $this->assign("jumpUrl", "__APP__/Vedio/index/id/{$course_id}");
         if ($result) {
             $this->success("添加成功!");
         } else {
             $this->error("添加不成功");
         }
     }
 }
开发者ID:highestgoodlikewater,项目名称:class-website,代码行数:26,代码来源:VedioAction.class.php

示例11: saveBasic_Pic

 public function saveBasic_Pic()
 {
     $sqlGood = new sql_goodMod();
     $g_id = $this->in_post('id', None, 1, 'True');
     $a_id = $this->in_cookie('aid', None, 1, 'True');
     $upload = new UploadFile();
     //设置上传文件大小
     $upload->maxSize = 1024 * 1024 * 2;
     //最大2M
     //设置上传文件类型
     $upload->allowExts = explode(',', 'jpg,gif,png');
     //设置附件上传目录
     $upload->savePath = '../public/image/';
     $upload->saveRule = cp_uniqid;
     if (!$upload->upload()) {
         //捕获上传异常
         $error_res = $this->error($upload->getErrorMsg());
         dump($error_res);
     } else {
         //取得成功上传的文件信息
         $up_res = $upload->getUploadFileInfo();
     }
     $ex_path = 'image/';
     $update_res = $sqlGood->set_brand_info_pic($a_id, $g_id, $ex_path . $up_res[0]['savename']);
     if ($update_res) {
         $this->alert('更新成功');
     } else {
         $this->alert('更新失败');
     }
 }
开发者ID:heYeCheng,项目名称:manager,代码行数:30,代码来源:brandMod.class.php

示例12: updataIconSubmit

 public function updataIconSubmit()
 {
     $upload = new UploadFile();
     /* 文件大小单位以字节为单位 */
     $upload->maxSize = C('UPLOAD_ICON_SIZE');
     $upload->allowExts = array('jpg');
     $upload->thumb = true;
     $upload->thumbMaxWidth = '200';
     $upload->thumbMaxHeight = '270';
     $upload->savePath = '../Public/Uploads/icons/';
     if (!$upload->upload()) {
         $info = $upload->getErrorMsg();
         echo '{"data":"' . $info . '","info":"' . $info . '","status":false}';
         /* $this->ajaxReturn ( $info, '更新失败', false ); */
     } else {
         $info = $upload->getUploadFileInfo();
         $m = M('UserBaseinfo');
         $data['icon'] = $info[0]['savename'];
         $result = $m->where('uid="' . $_POST['uid'] . '"')->save($data);
         if ($result) {
             writeOperationLog(APP_NAME, MODULE_NAME, ACTION_NAME, '更新头像');
             echo '{"data":"' . $result . '","info":"Profile updated!","status":true}';
             /* $this->ajaxReturn ( $result, '更新成功', true ); */
         } else {
             echo '{"data":"' . $result . '","info":"Profile update failed!","status":false}';
             /* $this->ajaxReturn ( $result, '更新失败', false ); */
         }
     }
 }
开发者ID:ahmatjan,项目名称:yaojike,代码行数:29,代码来源:SelfPanelAction.class.php

示例13: upimg

 public function upimg($path, $width = '300', $height = '150')
 {
     import("ORG.Net.UploadFile");
     $upload = new UploadFile();
     $upload->maxSize = '2048000';
     $upload->savePath = $path;
     $upload->saveRule = uniqid;
     $upload->allowExts = array('jpg', 'jpeg', 'png', 'gif', 'bmp');
     //$upload->allowTypes=array('','','','','','');
     //	是否生成缩略图
     $upload->thumb = true;
     $upload->thumbMaxWidth = $width;
     $upload->thumbMaxHeight = $height;
     //	缩略图前缀
     $upload->thumbPrefix = 'a';
     //	是否删除原图
     $upload->thumbRemoveOrigin = true;
     //	调用上传方法
     if ($upload->upload()) {
         //	成功则返回对应信息用于之后的调用
         $info = $upload->getUploadFileInfo();
         return $info;
     } else {
         $this->error($upload->getErrorMsg());
     }
 }
开发者ID:highestgoodlikewater,项目名称:3600KR,代码行数:26,代码来源:ArticleAction.class.php

示例14: addDoc

 public function addDoc()
 {
     $course_id = $_POST['course_id'];
     $zhang_name = $_POST['zhang_name'];
     $usertype = Cookie::get('usertype');
     $upload = new UploadFile($_POST['file']);
     $upload->allowExts = array('zip', 'rar', 'gz');
     $upload->savePath = './../Public/Uploads/document/';
     if (!$upload->upload()) {
         $this->error($upload->getErrorMsg());
     } else {
         $info = $upload->getUploadFileInfo();
     }
     $zhang = M('zhang');
     $zhang->create();
     $zhang->course_id = $course_id;
     $zhang->zhang_name = $zhang_name;
     $zhang->file = $info[0]['savename'];
     $result = $zhang->add();
     $this->assign("jumpUrl", "__APP__/Document/teacherindex/id/{$course_id}");
     if ($result) {
         $this->success("添加成功!");
     } else {
         $this->error($result->getErrorMsg());
     }
 }
开发者ID:highestgoodlikewater,项目名称:class-website,代码行数:26,代码来源:ZhangAction.class.php

示例15: up

 private function up()
 {
     //完成与thinkphp相关的,文件上传类的调用
     import('@.Org.UploadFile');
     //将上传类UploadFile.class.php拷到Lib/Org文件夹下
     $upload = new UploadFile();
     $upload->maxSize = '1000000';
     //默认为-1,不限制上传大小
     $upload->savePath = './Data/upload/';
     //保存路径建议与主文件平级目录或者平级目录的子目录来保存
     $upload->saveRule = uniqid;
     //上传文件的文件名保存规则
     $upload->uploadReplace = true;
     //如果存在同名文件是否进行覆盖
     $upload->allowExts = array('jpg', 'jpeg', 'gif', 'png', 'xls', 'xlsx', 'rar', 'zip', 'ppt', 'doc', 'docx');
     //准许上传的文件类型
     $upload->allowTypes = array('image/png', 'image/jpg', 'image/jpeg', 'image/gif');
     //检测mime类型
     $upload->thumb = true;
     //是否开启图片文件缩略图
     $upload->thumbMaxWidth = '300,500';
     $upload->thumbMaxHeight = '200,400';
     $upload->thumbPrefix = 's_,m_';
     //缩略图文件前缀
     $upload->thumbRemoveOrigin = 1;
     //如果生成缩略图,是否删除原图
     if ($upload->upload()) {
         $info = $upload->getUploadFileInfo();
         return $info;
     } else {
         $this->error($upload->getErrorMsg());
         //专门用来获取上传的错误信息的
     }
 }
开发者ID:yakrsa,项目名称:football,代码行数:34,代码来源:FileAction.class.php


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