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


PHP UploadFile::getInfo方法代码示例

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


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

示例1: upload_head

 public function upload_head()
 {
     $upfile_path = Tiny::getPath("uploads") . "/head/";
     $upfile_url = preg_replace("|" . APP_URL . "|", '', Tiny::getPath("uploads_url") . "head/", 1);
     //$upfile_url = strtr(Tiny::getPath("uploads_url")."head/",APP_URL,'');
     $upfile = new UploadFile('imgFile', $upfile_path, '500k', '', 'hash', $this->user['id']);
     $upfile->save();
     $info = $upfile->getInfo();
     $result = array();
     if ($info[0]['status'] == 1) {
         $result = array('error' => 0, 'url' => $upfile_url . $info[0]['path']);
         $image_url = $upfile_url . $info[0]['path'];
         $image = new Image();
         $image->suffix = '';
         $image->thumb(APP_ROOT . $image_url, 100, 100);
         $model = new Model('user');
         $model->data(array('head_pic' => $image_url))->where("id=" . $this->user['id'])->update();
         $safebox = Safebox::getInstance();
         $user = $this->user;
         $user['head_pic'] = $image_url;
         $safebox->set('user', $user);
     } else {
         $result = array('error' => 1, 'message' => $info[0]['msg']);
     }
     echo JSON::encode($result);
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:26,代码来源:ucenter.php

示例2: array

 function photoshop_upload()
 {
     $file = $_FILES['upfile'];
     if ($file['error'] == 4) {
         $msg = array('error', '请选择文件后再上传!');
         $this->redirect("photoshop", true, array('msg' => $msg));
     } else {
         if ($file['error'] == 1) {
             $msg = array('error', '文件超出了php.ini文件指定大小!');
             $this->redirect("photoshop", true, array('msg' => $msg));
         } else {
             if ($file['size'] > 0) {
                 $key = md5_file($file['tmp_name']);
                 $gallery = new Model('gallery');
                 $img = $gallery->where("`key`='" . $key . "'")->find();
                 echo JS::import('dialog?skin=brief');
                 echo JS::import('dialogtools');
                 if (!$img) {
                     $upfile_path = Tiny::getPath("uploads");
                     $upfile_url = preg_replace("|^" . APP_URL . "|", '', Tiny::getPath("uploads_url"));
                     $upfile = new UploadFile('upfile', $upfile_path, '10m');
                     $upfile->save();
                     $info = $upfile->getInfo();
                     $result = array();
                     if ($info[0]['status'] == 1) {
                         $url = $upfile_url . $info[0]['path'];
                         $key = md5_file($upfile_path . $info[0]['path']);
                         $type = Req::args("type") == null ? 0 : intval(Req::args('type'));
                         $gallery->data(array('key' => $key, 'type' => $type, 'img' => $url))->save();
                         echo "<script>art.dialog.opener.setImg('{$url}');</script>";
                     } else {
                         $msg = array('error', $info[0]['msg']);
                         $this->msg = $msg;
                         $this->redirect("photoshop", false);
                     }
                 } else {
                     $url = $img['img'];
                     echo "<script>art.dialog.opener.setImg('{$url}');</script>";
                 }
             }
         }
     }
     exit;
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:44,代码来源:admin.php

示例3: img_upload

 public function img_upload()
 {
     $path = APP_ROOT;
     $upf = new UploadFile('imgFile', $path, '2m', 'jpg,jpeg,gif');
     $upf->save();
     $info = $upf->getInfo();
     if ($info[0]['status'] == 1) {
         echo JSON::encode(array('error' => 0, 'url' => $info[0]['path']));
         exit;
     }
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:11,代码来源:index.php


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