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


PHP SaeStorage类代码示例

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


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


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