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


PHP uploader::getFileInfo方法代码示例

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


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

示例1: uploadImg

 private function uploadImg()
 {
     if (isset($_POST['upfile']) || $_FILES['upfile']) {
         header("Content-Type:text/html;charset=utf-8");
         error_reporting(E_ERROR | E_WARNING);
         $config = array("savePath" => imgPath, "maxSize" => maxSize, "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"));
         $up = new uploader($_SESSION['weixinId'], $this->newsId, "upfile", $config);
         $type = $_REQUEST['type'];
         $callback = $_GET['callback'];
         $info = $up->getFileInfo();
         wxlog(json_encode($info));
         /**
          * 返回数据
          */
         if ($callback) {
             echo '<script>' . $callback . '(' . json_encode($info) . ')</script>';
         } else {
             echo json_encode($info);
         }
     }
 }
开发者ID:btbj,项目名称:wechat,代码行数:21,代码来源:newsEdit.php

示例2: mylog

     mylog('frontUp');
     $inf = $uploader->getFileInfo();
     if ('SUCCESS' == $inf['state']) {
         $id = pdoInsert('ad_tbl', array('category' => 'banner', 'img_url' => $inf['url']), '');
         $inf['id'] = $id;
     }
     //        header('contentType:application/json');
     $jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
     mylog('imgUploaded:' . $jsonInf);
     echo $jsonInf;
     exit;
 }
 if (isset($_FILES['parts-img-up'])) {
     $uploader = new uploader('parts-img-up');
     $uploader->upFile($_GET['g_id'] . '_' . time() . rand(1000, 9999));
     $inf = $uploader->getFileInfo();
     $jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
     if ('SUCCESS' == $inf['state']) {
         mylog('success');
         $temp = pdoQuery('g_image_tbl', null, array('g_id' => $_GET['g_id']), 'limit 1');
         if (!($row = $temp->fetch())) {
             pdoInsert('g_image_tbl', array('g_id' => $_GET['g_id'], 'url' => $inf['url'], 'remark' => $inf['md5']), 'ignore');
             mylog("create record");
         } else {
             pdoUpdate('g_image_tbl', array('remark' => $inf['md5'], 'url' => $inf['url']), array('g_id' => $_GET['g_id']));
             $query = pdoQuery('image_view', null, array('remark' => $row['remark']), ' limit 1');
             if (!($t = $query->fetch())) {
                 unlink('../' . $row['url']);
                 mylog('unlink"../' . $row['url']);
             } else {
                 mylog('not unlink');
开发者ID:ldong728,项目名称:ashtonmall,代码行数:31,代码来源:upload.php

示例3: array

 * Time: 15:23
 */
header("Content-Type:text/html;charset=utf-8");
error_reporting(E_ERROR | E_WARNING);
$mypath = $_SERVER['DOCUMENT_ROOT'] . '/wechat';
include_once $mypath . '/includes/magicquotes.inc.php';
include_once $mypath . '/includes/db.inc.php';
include_once $mypath . '/includes/helpers.inc.php';
include_once $mypath . '/class/uploader.php';
session_start();
//上传配置
$config = array("savePath" => "../user_img", "maxSize" => 1000, "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"));
//上传文件目录
//$Path = "upload/";
//背景保存在临时目录中
//$config[ "savePath" ] = $Path;
if (!isset($_SESSION['temp_name'])) {
    $_SESSION['temp_name'] = getRandStr();
}
$up = new uploader($_SESSION['weixinId'], $_SESSION['temp_name'], "upfile", $config);
$type = $_REQUEST['type'];
$callback = $_GET['callback'];
$info = $up->getFileInfo();
/**
 * 返回数据
 */
if ($callback) {
    echo '<script>' . $callback . '(' . json_encode($info) . ')</script>';
} else {
    echo json_encode($info);
}
开发者ID:btbj,项目名称:wechat,代码行数:31,代码来源:uploadManage.php

示例4: upload

 public function upload()
 {
     /* 上传配置 */
     $base64 = "upload";
     switch (htmlspecialchars($_GET['action'])) {
         case 'uploadimage':
             $config = array("pathFormat" => $CONFIG['imagePathFormat'], "maxSize" => $CONFIG['imageMaxSize'], "allowFiles" => $CONFIG['imageAllowFiles']);
             $fieldName = $CONFIG['imageFieldName'];
             break;
         case 'uploadscrawl':
             $config = array("pathFormat" => $CONFIG['scrawlPathFormat'], "maxSize" => $CONFIG['scrawlMaxSize'], "allowFiles" => $CONFIG['scrawlAllowFiles'], "oriName" => "scrawl.png");
             $fieldName = $CONFIG['scrawlFieldName'];
             $base64 = "base64";
             break;
         case 'uploadvideo':
             $config = array("pathFormat" => $CONFIG['videoPathFormat'], "maxSize" => $CONFIG['videoMaxSize'], "allowFiles" => $CONFIG['videoAllowFiles']);
             $fieldName = $CONFIG['videoFieldName'];
             break;
         case 'uploadfile':
         default:
             $config = array("pathFormat" => $CONFIG['filePathFormat'], "maxSize" => $CONFIG['fileMaxSize'], "allowFiles" => $CONFIG['fileAllowFiles']);
             $fieldName = $CONFIG['fileFieldName'];
             break;
     }
     /* 生成上传实例对象并完成上传 */
     $up = new uploader($fieldName, $config, $base64);
     /**
      * 得到上传文件所对应的各个参数,数组结构
      * array(
      *     "state" => "",          //上传状态,上传成功时必须返回"SUCCESS"
      *     "url" => "",            //返回的地址
      *     "title" => "",          //新文件名
      *     "original" => "",       //原始文件名
      *     "type" => ""            //文件类型
      *     "size" => "",           //文件大小
      * )
      */
     /* 返回数据 */
     return json_encode($up->getFileInfo());
 }
开发者ID:JavaBird,项目名称:mysite,代码行数:40,代码来源:ueditor.php


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