PHP Class CloudAttachModel, thinksns

Show file Open project: medz/thinksns-4

Public Properties

Property Type Description
$allowExts 允许上传的文件后缀,留空不作后缀检查
$allowTypes 允许上传的文件类型,留空不做检查
$autoCheck
$customPath 上传文件保存路径
$hashType 上传文件Hash规则函数名,可以是 md5_file sha1_file 等
$maxSize 上传文件的最大值
$saveName
$savePath

Public Methods

Method Description
__construct ( ) 构造函数
getConfig ( ) 获取又拍云配置
getErrorMsg ( ) : string 取得最后一次错误信息
getFileContent ( $filename ) 获取附件内容
getFileUrl ( $filename ) 获取附件地址
getPolicy ( ) 获取policy
getPolicydoc ( ) 获取表单API相关信息
getSignature ( ) 获取signature
getUploadFileInfo ( ) : array 取得上传文件的信息
getUploadUrl ( ) 获取上传地址
getUrlPrefix ( ) 获取附件URL前缀
isOpen ( ) 是否开启Upyun
upload ( string $savePath = '' ) : string 上传文件

Protected Methods

Method Description
error ( string $errorNo ) 获取错误代码信息

Private Methods

Method Description
check ( array $file ) : boolean 检查上传的文件
checkExt ( string $ext ) : boolean 检查上传的文件后缀是否合法
checkSize ( integer $size ) : boolean 检查文件大小是否合法
checkType ( string $type ) : boolean 检查上传的文件类型是否合法
checkUpload ( string $filename ) : boolean 检查文件是否非法提交
dealFiles ( array $files ) : array 转换上传文件数组变量为正确的方式
getExt ( string $filename ) : boolean 取得上传文件的后缀

Method Details

__construct() public method

构造函数
public __construct ( )

error() protected method

获取错误代码信息
protected error ( string $errorNo )
$errorNo string 错误号码

getConfig() public method

获取又拍云配置
public getConfig ( )

getErrorMsg() public method

取得最后一次错误信息
public getErrorMsg ( ) : string
return string

getFileContent() public method

获取附件内容
public getFileContent ( $filename )

getFileUrl() public method

获取附件地址
public getFileUrl ( $filename )

getPolicy() public method

获取policy
public getPolicy ( )

getPolicydoc() public method

获取表单API相关信息
public getPolicydoc ( )

getSignature() public method

获取signature
public getSignature ( )

getUploadFileInfo() public method

取得上传文件的信息
public getUploadFileInfo ( ) : array
return array

getUploadUrl() public method

获取上传地址
public getUploadUrl ( )

getUrlPrefix() public method

获取附件URL前缀
public getUrlPrefix ( )

isOpen() public method

是否开启Upyun
public isOpen ( )

upload() public method

上传文件
public upload ( string $savePath = '' ) : string
$savePath string 上传文件保存路径
return string

Property Details

$allowExts public property

允许上传的文件后缀,留空不作后缀检查
public $allowExts

$allowTypes public property

允许上传的文件类型,留空不做检查
public $allowTypes

$autoCheck public property

public $autoCheck

$customPath public property

上传文件保存路径
public $customPath

$hashType public property

上传文件Hash规则函数名,可以是 md5_file sha1_file 等
public $hashType

$maxSize public property

上传文件的最大值
public $maxSize

$saveName public property

public $saveName

$savePath public property

public $savePath