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


PHP Uploader::getFileInfo方法代码示例

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


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

示例1: do_handle

 public function do_handle()
 {
     /* 抓取远程图片 */
     $list = array();
     if (isset($_POST[$this->fieldName])) {
         $source = $_POST[$this->fieldName];
     } else {
         $source = $_GET[$this->fieldName];
     }
     foreach ($source as $imgUrl) {
         $item = new Uploader($imgUrl, $this->config, "remote");
         $info = $item->getFileInfo();
         array_push($list, array("state" => $info["state"], "url" => $info["url"], "size" => $info["size"], "title" => htmlspecialchars($info["title"]), "original" => htmlspecialchars($info["original"]), "source" => htmlspecialchars($imgUrl)));
     }
     /* 返回抓取数据 */
     return json_encode(array('state' => count($list) ? 'SUCCESS' : 'ERROR', 'list' => $list));
 }
开发者ID:AlusaChen,项目名称:test-lar,代码行数:17,代码来源:Crawler.php

示例2: imgUpload

 public function imgUpload()
 {
     Vendor('um.Uploader', '', '.class.php');
     $config = array("savePath" => APP_PATH . "Public/Upload/", "maxSize" => 2 * 1024, "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"));
     $up = new Uploader("upfile", $config);
     $type = $_REQUEST['type'];
     $callback = $_GET['callback'];
     $info = $up->getFileInfo();
     $info['url'] = str_replace(APP_PATH, '', $info['url']);
     /**
      * 返回数据	
      */
     if ($callback) {
         echo '<script>' . $callback . '(' . json_encode($info) . ')</script>';
     } else {
         echo json_encode($info);
     }
 }
开发者ID:Roc2Z,项目名称:part-time-job-master,代码行数:18,代码来源:AdviceAction.class.php

示例3: array

<?php

header("Content-Type:text/html;charset=utf-8");
error_reporting(E_ERROR | E_WARNING);
date_default_timezone_set("Asia/chongqing");
include "Uploader.class.php";
//上传配置
$config = array("savePath" => "../../upload/", "maxSize" => 10000, "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"));
//上传文件目录
$Path = "upload/";
//背景保存在临时目录中
$config["savePath"] = $Path;
$up = new Uploader("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:geniushui,项目名称:360biji,代码行数:24,代码来源:imageUp.php

示例4: json_encode

    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:ndflydog,项目名称:blog,代码行数:30,代码来源:action_upload.php

示例5: json_encode

<?php

/**
 * 抓取远程图片
 * User: Jinqn
 * Date: 14-04-14
 * Time: 下午19:18
 */
set_time_limit(0);
include "Uploader.class.php";
/* 上传配置 */
$config = array("pathFormat" => $CONFIG['catcherPathFormat'], "maxSize" => $CONFIG['catcherMaxSize'], "allowFiles" => $CONFIG['catcherAllowFiles'], "oriName" => "remote.png");
$fieldName = $CONFIG['catcherFieldName'];
/* 抓取远程图片 */
$list = array();
if (isset($_POST[$fieldName])) {
    $source = $_POST[$fieldName];
} else {
    $source = $_GET[$fieldName];
}
foreach ($source as $imgUrl) {
    $item = new Uploader($imgUrl, $config, "remote");
    $info = $item->getFileInfo();
    array_push($list, array("state" => $info["state"], "url" => $info["url"], "source" => $imgUrl));
}
/* 返回抓取数据 */
return json_encode(array('state' => count($list) ? 'SUCCESS' : 'ERROR', 'list' => $list));
开发者ID:dlpc,项目名称:formdesign,代码行数:27,代码来源:action_crawler.php

示例6: array

        break;
    case 'uploadvideo':
        $config = array("pathFormat" => "/customers/{$cus_name}/images/ueditor/{time}{rand:6}", "maxSize" => $CONFIG['videoMaxSize'], "allowFiles" => $CONFIG['videoAllowFiles']);
        $fieldName = $CONFIG['videoFieldName'];
        break;
    case 'uploadfile':
    default:
        $config = array("pathFormat" => "/customers/{$cus_name}/images/ueditor/{time}{rand:6}", "maxSize" => $CONFIG['fileMaxSize'], "allowFiles" => $CONFIG['fileAllowFiles']);
        $fieldName = $CONFIG['fileFieldName'];
        break;
}
//$test=array('sta',1);
//return json_encode($test);
/* 生成上传实例对象并完成上传 */
$up = new Uploader($fieldName, $config, $base64);
$up_result = $up->getFileInfo();
/* 同步到客户服务器 */
if ($up_result['state'] == 'SUCCESS') {
    //同步到客户服务器
    $customerinfo = Customer::find($cus_id);
    $ftp_array = explode(':', $customerinfo->ftp_address);
    $ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : '21';
    $conn = ftp_connect($ftp_array[0], $ftp_array[1]);
    if ($conn) {
        ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd);
        /* 编辑器上传图片问题 */
        ftp_pasv($conn, 1);
        //===扣除空间===
        //                customers/$cus_name/images/ueditor/
        //        $size = filesize(public_path('customers/' . $cus_name . '/images/ueditor/' . $up_result['title']));
        //        $reg=ueditor_regular(1024);
开发者ID:baiduXM,项目名称:gbpen,代码行数:31,代码来源:action_upload.php

示例7: _crawler

 public function _crawler($CONFIG)
 {
     /**
      * 抓取远程图片
      * User: Jinqn
      * Date: 14-04-14
      * Time: 下午19:18
      */
     set_time_limit(0);
     // include("Uploader.class.php");
     /* 上传配置 */
     $config = array("pathFormat" => $CONFIG['catcherPathFormat'], "maxSize" => $CONFIG['catcherMaxSize'], "allowFiles" => $CONFIG['catcherAllowFiles'], "oriName" => "remote.png");
     $fieldName = $CONFIG['catcherFieldName'];
     /* 抓取远程图片 */
     $list = array();
     if (isset($_POST[$fieldName])) {
         $source = $_POST[$fieldName];
     } else {
         $source = $_GET[$fieldName];
     }
     foreach ($source as $imgUrl) {
         $item = new Uploader($imgUrl, $config, "remote");
         $info = $item->getFileInfo();
         array_push($list, array("state" => $info["state"], "url" => $info["url"], "size" => $info["size"], "title" => htmlspecialchars($info["title"]), "original" => htmlspecialchars($info["original"]), "source" => htmlspecialchars($imgUrl)));
     }
     /* 返回抓取数据 */
     return json_encode(array('state' => count($list) ? 'SUCCESS' : 'ERROR', 'list' => $list));
 }
开发者ID:PoppyLi,项目名称:PCMS,代码行数:28,代码来源:ueditor.php

示例8: upload

 /**
  * 各种上传
  * @param $fieldName
  * @param $config
  * @param $base64
  */
 protected function upload($fieldName, $config, $base64 = 'upload')
 {
     $up = new Uploader($fieldName, $config, $base64);
     $info = $up->getFileInfo();
     if ($this->thumbnail && $info['state'] == 'SUCCESS' && in_array($info['type'], array('.png', '.jpg', '.bmp', '.gif'))) {
         $info['thumbnail'] = $this->imageHandle($info['url']);
     }
     $info['url'] = Yii::app()->params['main_site'] . $info['url'];
     $result = json_encode($info);
     $this->show($result);
 }
开发者ID:bfyang5130,项目名称:zzl,代码行数:17,代码来源:UeditorController.php

示例9: json_encode

<?php

include "Uploader.class.php";
$CONFIG = json_decode(preg_replace("/\\/\\*[\\s\\S]+?\\*\\//", "", file_get_contents("config.json")), true);
#config
$config = array("pathFormat" => $CONFIG['imagePathFormat'], "maxSize" => $CONFIG['imageMaxSize'], "allowFiles" => $CONFIG['imageAllowFiles']);
$fieldName = "upload";
$base64 = "upload";
#这里要对$_File进行处理
$size = @$_GET["size"];
$json = array();
$temp_array = $_FILES;
for ($i = 0; $i < $size; $i++) {
    $name = @$temp_array[$fieldName]["name"][$i];
    $type = @$temp_array[$fieldName]["type"][$i];
    $tmp_name = @$temp_array[$fieldName]["tmp_name"][$i];
    $error = @$temp_array[$fieldName]["error"][$i];
    $sizez = @$temp_array[$fieldName]["size"][$i];
    $_FILES = array();
    $_FILES[$fieldName]["name"] = $name;
    $_FILES[$fieldName]["type"] = $type;
    $_FILES[$fieldName]["tmp_name"] = $tmp_name;
    $_FILES[$fieldName]["error"] = $error;
    $_FILES[$fieldName]["size"] = $sizez;
    #config change
    $up = new Uploader($fieldName, $config, $base64);
    $res = $up->getFileInfo();
    $json[] = $res;
}
#echo
echo json_encode($json);
开发者ID:qiyulin,项目名称:php_workspace,代码行数:31,代码来源:action_upload_many.php

示例10: do_handle

 public function do_handle()
 {
     $up = new Uploader($this->fieldName, $this->config, $this->base64);
     return json_encode($up->getFileInfo());
 }
开发者ID:AlusaChen,项目名称:test-lar,代码行数:5,代码来源:Upload.php

示例11: mfile

 /**
  * 文件处理服务
  * @param string $Root,string $cmd,string $target
  * @return array 
  */
 public function mfile($ROOT, $cmd, $target)
 {
     switch ($cmd) {
         case 'init':
             return getArray('0', 'success', array('root' => getFileInfo('/', $ROOT), 'config' => array()));
             break;
         case 'ls':
             if (isset($_GET['target'])) {
                 $target = $_GET['target'];
             } else {
                 $target = '';
             }
             $list = listFile($target, $ROOT);
             return getArray('0', 'success', array('files' => $list));
             break;
         case 'rename':
             $name = $_GET['name'];
             if (file_exists($ROOT . $name)) {
                 $res = false;
                 $msg = 'file exist';
             } else {
                 $res = rename($ROOT . $target, $ROOT . $name);
             }
             if ($res) {
                 return getArray('0', 'success', array('file' => getFileInfo($name, $ROOT)));
             } else {
                 return getArray('1', $msg ? $msg : 'rename error');
             }
             break;
         case 'rm':
             foreach ($target as $key => $path) {
                 if (is_dir($ROOT . $path)) {
                     $res = removeDir($ROOT . $path);
                 } else {
                     $res = unlink($ROOT . $path);
                 }
                 if (!$res) {
                     break;
                 }
             }
             if ($res) {
                 return getArray('0', 'success');
             } else {
                 return getArray('1', 'romove error');
             }
             break;
         case 'touch':
             if (!file_exists($ROOT . $target)) {
                 file_put_contents($ROOT . $target, '');
                 $res = file_exists($ROOT . $target);
             } else {
                 $res = false;
                 $msg = 'file exist';
             }
             if ($res) {
                 return getArray('0', 'success', array('file' => getFileInfo($target, $ROOT)));
             } else {
                 return getArray('1', $msg ? $msg : 'touch error');
             }
             break;
         case 'mkdir':
             if (!file_exists($ROOT . $target)) {
                 $res = mkdir($ROOT . $target);
             } else {
                 $res = false;
                 $msg = 'file exist';
             }
             if ($res) {
                 return getArray('0', 'success', array('file' => getFileInfo($target, $ROOT)));
             } else {
                 return getArray('1', $msg ? $msg : 'mkdir error', array('file' => getFileInfo($target, $ROOT)));
             }
             break;
         case 'upload':
             include "Uploader.class.php";
             $uploadConfig = array("savePath" => $ROOT . $target, "maxSize" => 200000, "allowFiles" => array(".rar", ".zip", ".7z", "tar", "gz", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", "", ".txt", ".pdf", ".bmp", ".gif", ".jpg", ".jpeg", ".png", ".psd", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg", ".ogg", ".mov", ".wmv", ".mp4", ".webm"));
             $up = new Uploader("file", $uploadConfig);
             $info = $up->getFileInfo();
             if ($info["state"] == 'SUCCESS') {
                 return getArray('0', 'success', array('file' => getFileInfo($target . $info["name"], $ROOT)));
             } else {
                 return getArray('1', $info["state"], array('file' => getFileInfo($target . $info["name"], $ROOT)));
             }
             break;
         case 'download':
             $path = $ROOT . $target;
             $info = getFileInfo($target, $ROOT);
             downloadFile($path, $info['name']);
             break;
         case 'info':
             return getArray('0', 'success', array('file' => getFileInfo($target, $ROOT)));
             break;
         default:
             return getArray('1', 'unknow command');
             break;
//.........这里部分代码省略.........
开发者ID:NwuNet,项目名称:NetService,代码行数:101,代码来源:FileService.class.php

示例12: json_encode

    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('http://m2.nadoo.cn/p/zyw'));
开发者ID:songxiaoxiao,项目名称:zyw,代码行数:30,代码来源:action_upload.php

示例13: crawler

 private function crawler()
 {
     set_time_limit(0);
     /* 上传配置 */
     $config = array("pathFormat" => $this->conf['catcherPathFormat'], "maxSize" => $this->conf['catcherMaxSize'], "allowFiles" => $this->conf['catcherAllowFiles'], "oriName" => "remote.png");
     $fieldName = $this->conf['catcherFieldName'];
     /* 抓取远程图片 */
     $list = array();
     if (isset($_POST[$fieldName])) {
         $source = $_POST[$fieldName];
     } else {
         $source = $_GET[$fieldName];
     }
     foreach ($source as $imgUrl) {
         $item = new Uploader($imgUrl, $config, "remote");
         $info = $item->getFileInfo();
         array_push($list, array("state" => $info["state"], "url" => $info["url"], "size" => $info["size"], "title" => htmlspecialchars($info["title"]), "original" => htmlspecialchars($info["original"]), "source" => htmlspecialchars($imgUrl)));
     }
     /* 返回抓取数据 */
     return json_encode(array('state' => count($list) ? 'SUCCESS' : 'ERROR', 'list' => $list));
 }
开发者ID:noikiy,项目名称:shop-3,代码行数:21,代码来源:UploadController.class.php


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