• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SaeStorage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: session_start

<?php

session_start();
include_once 'saestorage.class.php';
?>

<html>

	<body>
		<form action="index.php" method="post" enctype="multipart/form-data">
			<input type = "file" name="myfile" size="100" /><br>
			<input type = "submit" value= "upload" / >
		</form>
	</body>
</html>

<?php 
$domain = "itemsimage";
$file_name = $_FILES["myfile"]["name"];
$temp_arr = explode(".", $file_name);
$file_ext = array_pop($temp_arr);
$file_ext = trim($file_ext);
$file_ext = strtolower($file_ext);
$new_file_name = date("YmdHis") . '_' . rand(10000, 99999) . '.' . $file_ext;
$s = new SaeStorage();
//$s->upload( 'imagefile',$_FILES["myfile"]["name"],$_FILES["myfile"]["name"]);
echo $aimage = $s->upload('itemsimage', $new_file_name, $_FILES["myfile"]["tmp_name"]);
echo md5("123456");
开发者ID:sueflybaby,项目名称:learngit,代码行数:28,代码来源:index.php


示例2: upradio

 static function upradio($radio)
 {
     $s = new SaeStorage();
     $mname = $_FILES[$radio]['name'];
     $msize = $_FILES[$radio]['size'];
     if ($mname != "") {
         if ($msize > 10240000) {
             echo '图片大小不能超过10M';
             exit;
         }
         $type = strstr($mname, '.');
         if ($type != ".mp3") {
             echo '对不起!只支持mp3格式,如果是这几种格式请去掉处文件标识符以外的点"."';
             exit;
         }
         if (!$_FILES[$radio]['name']) {
             die('没有选择文件!');
         }
         //上传文件校验,可以添加文件类型等检验、此处简略处理
         $file_name = "m_" . time() . rand(100, 999);
         //定义保存的文件名称
         $m_path = $file_name . $type;
         //要保存的文件路径+文件名,此处保存在根目录下
         $link = $s->upload('upcon', $m_path, $_FILES[$radio]['tmp_name']);
         if ($link) {
             $out_radio = array('m_name' => $file_name, 'm_url' => $link);
             echo json_encode($out_radio);
         } else {
             $emsg = $s->errmsg();
             $this->writelog_debug($emsg);
             die('上传零时文件失败!');
         }
     }
 }
开发者ID:acsiiii,项目名称:leeeframework,代码行数:34,代码来源:audio.php


示例3: actionImageManager

 public function actionImageManager()
 {
     $path = "data/editor/image/" . Ibos::app()->user->uid;
     $action = EnvUtil::getRequest("action");
     if ($action == "get") {
         if (!defined("SAE_TMP_PATH")) {
             $files = $this->getfiles($path);
             if (!$files) {
                 return null;
             }
             rsort($files, SORT_STRING);
             $str = "";
             foreach ($files as $file) {
                 $str .= "../../../../../../" . $file . "ue_separate_ue";
             }
             echo $str;
         } else {
             $st = new SaeStorage();
             $num = 0;
             while ($ret = $st->getList("data", $path, 100, $num)) {
                 foreach ($ret as $file) {
                     if (preg_match("/\\.(gif|jpeg|jpg|png|bmp)\$/i", $file)) {
                         echo $st->getUrl("data", $file) . "ue_separate_ue";
                     }
                     $num++;
                 }
             }
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:30,代码来源:EditorController.php


示例4: index

 public function index()
 {
     if ($_GET['fp'] != 1 && $_COOKIE['tennis-club'] != null) {
         $this->redirect('Index:index_' . $_COOKIE['tennis-club']);
     }
     $s = new SaeStorage();
     $waiting = "";
     $city_id = $_GET['cityId'];
     // 设置数组
     $currentProvince = array();
     $provinceList = array();
     $cityList = array();
     $clubList = array();
     // 定义数据库查询变量
     $PROVINCE = M('province');
     $CITY = M('city');
     $CLUB = M('club');
     // 查询省市列表
     $provinceList = $PROVINCE->getField("province_id, province_id, province_name");
     if ($city_id == null) {
         // 获取打开页面者所在城市
         $city = $this->getIPCity();
         // 查询数据库获取城市列表
         $province = $CITY->where("city_name like '%" . $city . "%'")->join("INNER JOIN province ON province.province_id=city.province_id")->getField('city_id, city_id, city_name, city.province_id, province_name');
         $currentProvince = current($province);
         $cityList = $CITY->where('province_id=' . $currentProvince['province_id'])->getField('city_id, city_id, city_name');
         // 查询俱乐部列表
         $clubList = $CLUB->where("city_id=" . $currentProvince['city_id'])->getField("id, id, name");
         if ($clubList != null) {
             foreach ($clubList as $key => $value) {
                 $clubList[$key]['portrait'] = $s->getUrl("imgdomain", 'club_portrait/club' . $value['id'] . '.jpg');
             }
         } else {
             $waiting = "等待当地俱乐部入驻。。。";
         }
     } else {
         $province = $CITY->where("city_id=" . $city_id)->join("INNER JOIN province ON province.province_id=city.province_id")->getField('city_id, city_id, city_name, city.province_id, province_name');
         $currentProvince = current($province);
         $cityList = $CITY->where('province_id=' . $currentProvince['province_id'])->getField('city_id, city_id, city_name');
         // 查询俱乐部列表
         $clubList = $CLUB->where("city_id=" . $currentProvince['city_id'])->getField("id, id, name");
         if ($clubList != null) {
             foreach ($clubList as $key => $value) {
                 $clubList[$key]['portrait'] = $s->getUrl("imgdomain", 'club_portrait/club' . $value['id'] . '.jpg');
             }
         } else {
             $waiting = "等待当地俱乐部入驻。。。";
         }
     }
     $this->assign("currentProvinceId", $currentProvince['province_id']);
     $this->assign("currentProvinceName", $currentProvince['province_name']);
     $this->assign("currentCityId", $currentProvince['city_id']);
     $this->assign("currentCityName", $currentProvince['city_name']);
     $this->assign("provinceList", $provinceList);
     $this->assign("cityList", $cityList);
     $this->assign("clubList", $clubList);
     $this->assign("waiting", $waiting);
     $this->display();
 }
开发者ID:ElvisJazz,项目名称:tenniser,代码行数:59,代码来源:IndexAction.class.php


示例5: saeup

function saeup($date, $filename)
{
    $storage = new SaeStorage();
    $domain = 'img';
    $destFileName = $filename . 'jpg';
    $srcFileName = $_FILES['tmp_name'];
    $result = $storage->upload($domain, $destFileName, $date["tmp_name"]);
    return $result;
}
开发者ID:renzg,项目名称:wxwall,代码行数:9,代码来源:updata.php


示例6: Storage_Return_Url

/**
 * @param $upload
 * @return null
 */
function Storage_Return_Url($upload)
{
    global $zbp, $domainname;
    $file = new Upload();
    $file = $zbp->GetUploadByID($upload->ID);
    $s = new SaeStorage();
    $url = $s->getUrl($domainname, $file->Metas->Storage_URL);
    return $url;
}
开发者ID:ijustyce,项目名称:zblogphp,代码行数:13,代码来源:include.php


示例7: putFileContent

 public static function putFileContent($filename, $content)
 {
     if (OpenConfig::SAE_MODE) {
         $s = new SaeStorage();
         $s->write(OpenConfig::SAE_DOMAIN, $filename, $content);
     } else {
         $data = file_put_contents($filename, $content);
     }
 }
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:9,代码来源:lib.php


示例8: getSaeFiles

function getSaeFiles($domain, $path, $allowFiles, &$files = array())
{
    $stor = new SaeStorage();
    $res = $stor->getListByPath($domain, $path, 1000, 0, false);
    foreach ($res as $val) {
        $url = $stor->getUrl($domain, $val['fullName']);
        $files[] = array('url' => $url, 'mtime' => $val['uploadTime']);
    }
    return $files;
}
开发者ID:ljhchshm,项目名称:cms,代码行数:10,代码来源:action_list.php


示例9: delete_mp3

function delete_mp3($fileName)
{
    $stor = new SaeStorage();
    $stor->delete(SAE_DOMAIN, $fileName);
    if ($errmsg == 0) {
        $result['success'] = 1;
    } else {
        $result['success'] = -1;
    }
    return $result;
}
开发者ID:surperone,项目名称:mp3dish,代码行数:11,代码来源:common_sae.php


示例10: readModule

function readModule($fileName)
{
    if ($fileName !== null) {
        $fileName = basename($fileName);
        $s = new SaeStorage();
        $content = $s->fileExists(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . $fileName) ? $s->read(SAE_STORAGE_DOMAIN, SAE_MODULES . "/" . $fileName) . "\n" : "Module File Not Found!";
        return htmlspecialchars($content, ENT_QUOTES);
    } else {
        return "Module File Not Found!";
    }
}
开发者ID:mitv1c,项目名称:XssRat,代码行数:11,代码来源:readmodule.php


示例11: s_file_exists

 function s_file_exists($path)
 {
     if (IS_SAE) {
         $ret = file_exists($path);
         if (!$ret) {
             $_s = new SaeStorage();
             $path = str_replace(FCPATH, '', $path);
             $_f = _s_get_path($path);
             return $_s->fileExists($_f['domain'], $_f['filename']);
         }
     } else {
         return file_exists($path);
     }
 }
开发者ID:troywmz,项目名称:JustWriting,代码行数:14,代码来源:storage_helper.php


示例12: __construct

 public function __construct($ACCESS_TOKEN)
 {
     if (isset($_SERVER["HTTP_APPNAME"])) {
         $storage = new SaeStorage();
         $domain = "xycn";
         $filename = "menu.json";
         $this->menu = $storage->read($domain, $filename);
     } else {
         //LOCAL
         $this->menu = file_get_contents("menu.json");
     }
     $this->MENU_CREATE_URL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" . $ACCESS_TOKEN;
     $this->MENU_GET_URL = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=" . $ACCESS_TOKEN;
     $this->MENU_DELETE_URL = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" . $ACCESS_TOKEN;
 }
开发者ID:ad52825196,项目名称:wechat-xingyechangning,代码行数:15,代码来源:menu.php


示例13: photo

 public function photo()
 {
     $photo = M('photo');
     $s = new SaeStorage();
     $path = $photo->where('id=' . $_GET['id'])->getField('path');
     $list = $s->getListByPath('imgdomain', $path);
     $files = $list["files"];
     $imgUrlList = array();
     foreach ($files as $imageFile) {
         $imgUrl = $s->getUrl("imgdomain", $path . "/" . $imageFile['Name']);
         array_push($imgUrlList, $imgUrl);
     }
     $this->assign('list', $imgUrlList);
     $this->display();
 }
开发者ID:ElvisJazz,项目名称:tenniser,代码行数:15,代码来源:PhotoAction.class.php


示例14: upFile

 private function upFile($base64)
 {
     if ("base64" == $base64) {
         $content = $_POST[$this->fileField];
         $this->base64ToImage($content);
         return null;
     }
     $file = $this->file = $_FILES[$this->fileField];
     if (!$file) {
         $this->stateInfo = $this->getStateInfo("POST");
         return null;
     }
     if ($this->file["error"]) {
         $this->stateInfo = $this->getStateInfo($file["error"]);
         return null;
     }
     if (!is_uploaded_file($file["tmp_name"])) {
         $this->stateInfo = $this->getStateInfo("UNKNOWN");
         return null;
     }
     $this->oriName = $file["name"];
     $this->fileSize = $file["size"];
     $this->fileType = $this->getFileExt();
     if (!$this->checkSize()) {
         $this->stateInfo = $this->getStateInfo("SIZE");
         return null;
     }
     if (!$this->checkType()) {
         $this->stateInfo = $this->getStateInfo("TYPE");
         return null;
     }
     $this->fullName = $this->getFolder() . "/" . $this->getName();
     if ($this->stateInfo == $this->stateMap[0]) {
         if (!defined("SAE_TMP_PATH")) {
             if (!move_uploaded_file($file["tmp_name"], $this->fullName)) {
                 $this->stateInfo = $this->getStateInfo("MOVE");
             }
         } else {
             $st = new SaeStorage();
             $url = $st->upload("data", $this->fullName, $file["tmp_name"]);
             if (!$url) {
                 $this->stateInfo = $this->getStateInfo("MOVE");
             } else {
                 $this->fullName = $url;
             }
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:48,代码来源:EditorUploader.php


示例15: save

 /**
  * 保存指定文件
  * @param  array   $file    保存的文件信息
  * @param  boolean $replace 同名文件是否覆盖
  * @return boolean          保存状态,true-成功,false-失败
  */
 public function save($file, $replace = true)
 {
     $filename = ltrim($this->rootPath . '/' . $file['savepath'] . $file['savename'], '/');
     $st = new \SaeStorage();
     /* 不覆盖同名文件 */
     if (!$replace && $st->fileExists($this->domain, $filename)) {
         $this->error = '存在同名文件' . $file['savename'];
         return false;
     }
     /* 移动文件 */
     if (!$st->upload($this->domain, $filename, $file['tmp_name'])) {
         $this->error = '文件上传保存错误![' . $st->errno() . ']:' . $st->errmsg();
         return false;
     }
     return true;
 }
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:22,代码来源:Sae.class.php


示例16: Delete

 public function Delete($fileName)
 {
     $res = array('result' => false, 'reason' => '');
     $file_path = SAE_MODULES . '/' . $fileName;
     $s = new SaeStorage();
     if ($s->fileExists(SAE_STORAGE_DOMAIN, $file_path)) {
         if ($s->delete(SAE_STORAGE_DOMAIN, $file_path)) {
             $res['result'] = true;
             $res['reason'] = $fileName;
         } else {
             $res['reason'] = $this->messages['6'];
         }
     } else {
         $res['reason'] = $this->messages['4'];
     }
 }
开发者ID:mitv1c,项目名称:XssRat,代码行数:16,代码来源:UploadHandler.php


示例17: save

 /**
  * 保存上传文件
  *
  * 需要设置存放SAE的domain,可修改 Upload::$default_directory = 'newdomain';
  *
  * @param array $file
  * @param string $filename
  * @param string $directory
  * @param int $chmod
  */
 public static function save(array $file, $filename = NULL, $directory = NULL, $chmod = 0644)
 {
     if (!isset($file['tmp_name']) or !is_uploaded_file($file['tmp_name'])) {
         // Ignore corrupted uploads
         return false;
     }
     if ($filename === null) {
         // Use the default filename, with a timestamp pre-pended
         $filename = uniqid() . $file['name'];
     }
     if (Upload::$remove_spaces === true) {
         // Remove spaces from the filename
         $filename = preg_replace('/\\s+/', '_', $filename);
     }
     $obj = new SaeStorage();
     return $obj->upload(Upload::$default_directory, $filename, $file['tmp_name']);
 }
开发者ID:xiaodin1,项目名称:myqee,代码行数:27,代码来源:upload.class.php


示例18: add_photo

 /**
  * 用flash添加照片
  */
 function add_photo()
 {
     if ($_FILES) {
         global $php;
         $php->upload->thumb_width = 136;
         $php->upload->thumb_height = 136;
         $php->upload->max_width = 500;
         $php->upload->max_height = 500;
         $php->upload->thumb_qulitity = 100;
         if (class_exists('SaeStorage', false)) {
             $s = new SaeStorage();
             $file_id = uniqid('pic_', false) . mt_rand(1, 100);
             $tmp_file = SAE_TMP_PATH . '/thum_' . $file_id . '.jpg';
             Image::thumbnail($_FILES['Filedata']['tmp_name'], $tmp_file, $php->upload->thumb_width, $php->upload->thumb_height, $php->upload->thumb_qulitity, false);
             $pic = '/uploads/' . $file_id . ".jpg";
             $ret = $s->upload('static', $pic, $_FILES['Filedata']['tmp_name']);
             if ($ret) {
                 $data['picture'] = $s->getUrl('static', $pic);
             } else {
                 echo $s->errmsg() . ' : ' . $s->errno();
                 return;
             }
             $thum_pic = '/uploads/thum_' . $file_id . '.jpg';
             $ret = $s->upload('static', $thum_pic, $tmp_file);
             if ($ret) {
                 $data['imagep'] = $s->getUrl('static', $thum_pic);
             } else {
                 echo $s->errmsg() . ' : ' . $s->errno();
                 return;
             }
         } else {
             $php->upload->sub_dir = 'user_images';
             $up_pic = Swoole::$php->upload->save('Filedata');
             if (empty($up_pic)) {
                 return '上传失败,请重新上传! Error:' . $php->upload->error_msg;
             }
             $data['picture'] = $up_pic['name'];
             $data['imagep'] = $up_pic['thumb'];
         }
         $data['uid'] = $_POST['uid'];
         $up_pic['photo_id'] = $this->swoole->model->UserPhoto->put($data);
         /* if(isset($_POST['post']))
            {
            	Api::feed('photo', $data['uid'], 0, $up_pic['photo_id']);
            } */
         return json_encode($up_pic);
     } else {
         $this->swoole->tpl->display('myphoto_add_photo.html');
     }
 }
开发者ID:netstao,项目名称:swoole.com,代码行数:53,代码来源:myphoto.php


示例19: handleFiles

function handleFiles($typeId, $tmpNames, $names)
{
    global $IS_SAE;
    $result = array("success" => true, "details" => array());
    $ext_arr = array();
    for ($i = 0; $i < count($names); $i++) {
        $tmp = explode(".", $names[$i]);
        $tmp = $tmp[count($tmp) - 1];
        array_push($ext_arr, $tmp);
    }
    // when name the folder, here we wipe the parameter $type.
    $directory = "../resources/chart/{$typeId}/";
    if ($IS_SAE) {
        $st = new SaeStorage();
        $attr = array('encoding' => 'gzip');
        for ($i = 0; $i < count($names); $i++) {
            $tName = $tmpNames[$i];
            $oName = $names[$i];
            $file_new_name = date("YmdHis") . str_pad(rand(0, 9999), 4, rand(0, 9), STR_PAD_LEFT) . "." . $ext_arr[$i];
            $uploadRes = $st->upload($_SERVER['HTTP_APPNAME'], $file_new_name, $_FILES['photo']['tmp_name'][$i], $attr, true);
            if ($uploadRes === false) {
                array_push($result["details"], array("success" => false, "msg" => "图片'{$oName}'上传失败!error:" . $st->errno() . ' ' . $st->errmsg(), "file" => '', "original_file_name" => $oName));
            } else {
                array_push($result["details"], array("success" => true, "msg" => "图片'{$oName}'上传成功!重命名为'{$file_new_name}'。", "file" => $uploadRes, "original_file_name" => $oName));
            }
        }
    } else {
        if (!file_exists($directory)) {
            if (!mkdir($directory)) {
                throw new Exception("文件夹创建失败!" . $directory);
            }
        }
        for ($i = 0; $i < count($names); $i++) {
            $tName = $tmpNames[$i];
            $oName = $names[$i];
            $file_new_name = date("YmdHis") . str_pad(rand(0, 9999), 4, rand(0, 9), STR_PAD_LEFT) . "." . $ext_arr[$i];
            if (move_uploaded_file($tName, $directory . $file_new_name)) {
                array_push($result["details"], array("success" => true, "msg" => "图片'{$oName}'上传成功!重命名为'{$file_new_name}'。", "file" => $directory . $file_new_name, "original_file_name" => $oName));
            } else {
                array_push($result["details"], array("success" => false, "msg" => "图片'{$oName}'上传失败!", "file" => '', "original_file_name" => $oName));
            }
        }
    }
    return $result;
}
开发者ID:hxghxg527,项目名称:FamilyDecoration,代码行数:45,代码来源:upload.php


示例20: file_list_upload

/**
 * 上传目录列表
 * @param string $path 目录名
 * @return array
 */
function file_list_upload($path)
{
    $config = C('TMPL_PARSE_STRING');
    switch (strtoupper(C('FILE_UPLOAD_TYPE'))) {
        case 'SAE':
            $path = str_replace(DS, '/', rtrim($path, DS));
            $arr = explode('/', ltrim($path, './'));
            $domain = array_shift($arr);
            $filePath = implode('/', $arr);
            $s = new SaeStorage();
            $list = $s->getListByPath($domain, $filePath);
            $res = array();
            while (isset($list['dirNum']) && $list['dirNum']) {
                $list['dirNum']--;
                array_push($res, array('type' => 'dir', 'name' => $list['dirs'][$list['dirNum']]['name'], 'path' => ltrim($list['dirs'][$list['dirNum']]['fullName'], 'upload/'), 'size' => '-', 'mtime' => '-', 'url' => '#'));
            }
            while (isset($list['fileNum']) && $list['fileNum']) {
                $list['fileNum']--;
                array_push($res, array('type' => 'file', 'name' => $list['files'][$list['fileNum']]['Name'], 'path' => ltrim($list['files'][$list['fileNum']]['fullName'], 'upload/'), 'size' => format_bytes($list['files'][$list['fileNum']]['length'], ' '), 'mtime' => date('Y-m-d H:i:s', $list['files'][$list['fileNum']]['uploadTime']), 'url' => ltrim($list['files'][$list['fileNum']]['fullName'], 'upload/')));
            }
            return $res;
            break;
        case 'FTP':
            $storage = new \Common\Plugin\Ftp();
            $list = $storage->ls($path);
            foreach ($list as &$item) {
                $item['path'] = ltrim($item['path'], UPLOAD_PATH);
                $item['url'] = str_replace('\\', '/', $item['path']);
            }
            return $list;
            break;
        default:
            $path = realpath($path);
            $path = str_replace(array('/', '\\'), DS, $path);
            $list = glob($path . DS . '*');
            $res = array();
            foreach ($list as $key => $filename) {
                array_push($res, array('type' => is_dir($filename) ? 'dir' : 'file', 'name' => basename($filename), 'path' => ltrim(str_replace(realpath(UPLOAD_PATH), '', $filename), DS), 'size' => format_bytes(filesize($filename), ' '), 'mtime' => date('Y-m-d H:i:s', filemtime($filename)), 'url' => ltrim(str_replace(array(realpath(UPLOAD_PATH), '\\'), array('', '/'), $filename), '/')));
            }
            return $res;
    }
}
开发者ID:tiger2soft,项目名称:app,代码行数:47,代码来源:function.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SaeTClientV2类代码示例发布时间:2022-05-23
下一篇:
PHP SaeMysql类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap