PHP Class FileUpload

Datei anzeigen Open project: yinhe/yincart Class Usage Examples

Public Properties

Property Type Description
$filename
$instance
$size 允许的类型
$target 允许的大小(KB)
$type 文件上传实例

Public Methods

Method Description
__construct ( $name, $target, $type = '*', $size = '2048' )
getError ( $name = false ) 获取某一个错误信息
getErrors ( ) 获取所有的错误信息
isNull ( ) 判断文件实例是否存在
save ( ) 主函数,验证并保存图片

Protected Methods

Method Description
checkSize ( )
checkType ( ) 检查文件类型
getFileName ( ) 获取新的文件名
makeDir ( ) 设置目录
randName ( ) 生成随机名
setSize ( $size ) 设置允许的文件上传大小,并转为字节单位

Private Methods

Method Description
addError ( $name, $msg ) 添加错误信息

Method Details

__construct() public method

public __construct ( $name, $target, $type = '*', $size = '2048' )

checkSize() protected method

protected checkSize ( )

checkType() protected method

检查文件类型
protected checkType ( )

getError() public method

获取某一个错误信息
public getError ( $name = false )

getErrors() public method

获取所有的错误信息
public getErrors ( )

getFileName() protected method

获取新的文件名
protected getFileName ( )

isNull() public method

判断文件实例是否存在
public isNull ( )

makeDir() protected method

设置目录
protected makeDir ( )

randName() protected method

生成随机名
protected randName ( )

save() public method

主函数,验证并保存图片
public save ( )

setSize() protected method

设置允许的文件上传大小,并转为字节单位
protected setSize ( $size )

Property Details

$filename public_oe property

public $filename

$instance public_oe property

public $instance

$size public_oe property

允许的类型
public $size

$target public_oe property

允许的大小(KB)
public $target

$type public_oe property

文件上传实例
public $type