PHP Class Swoole\Upload

Author: Tianfeng.Han
Afficher le fichier Open project: matyhtf/swoole_framework Class Usage Examples

Méthodes publiques

Свойство Type Description
$allow
$base_dir 上传文件的根目录
$base_url 替换后的域名
$error_code integer 错误代码 0,不存在的上传 1,未知的mime格式 2,不允许上传的格式 3,文件已存在 4,文件尺寸超过最大
$error_msg
$exist_check 检查是否存在同名的文件
$filename_type 文件命名法
$max_height 如果为0的话不压缩
$max_qulitity
$max_size
$max_width 限制上传文件的尺寸,如果超过尺寸,则压缩
$mimes
$name_type 允许上传的类型
$overwrite 允许覆盖文件
$shard_argv 子目录生成参数
$shard_type 子目录生成方法,可以使用randomkey,或者date
$sub_dir 指定子目录
$thumb_dir 产生缩略图
$thumb_height 如果为0的话不生成缩略图
$thumb_qulitity
$thumb_width

Méthodes publiques

Méthode Description
__construct ( $config )
error_msg ( )
getFileExt ( $file ) : string 根据文件名获取扩展名
getMimeType ( $mime ) : boolean 获取MIME对应的扩展名
moveUploadFile ( $tmpfile, $newfile )
save ( $name, null $filename = null, null $allow = null ) : boolean 保存上传的图片
save_all ( )

Method Details

__construct() public méthode

public __construct ( $config )

error_msg() public méthode

public error_msg ( )

getFileExt() public static méthode

根据文件名获取扩展名
public static getFileExt ( $file ) : string
$file
Résultat string

getMimeType() public méthode

获取MIME对应的扩展名
public getMimeType ( $mime ) : boolean
$mime
Résultat boolean

moveUploadFile() static public méthode

static public moveUploadFile ( $tmpfile, $newfile )

save() public méthode

保存上传的图片
public save ( $name, null $filename = null, null $allow = null ) : boolean
$name
$filename null
$allow null
Résultat boolean

save_all() public méthode

public save_all ( )

Property Details

$allow public_oe property

public $allow

$base_dir public_oe property

上传文件的根目录
public $base_dir

$base_url public_oe property

替换后的域名
public $base_url

$error_code public_oe property

错误代码 0,不存在的上传 1,未知的mime格式 2,不允许上传的格式 3,文件已存在 4,文件尺寸超过最大
public int $error_code
Résultat integer

$error_msg public_oe property

public $error_msg

$exist_check public_oe property

检查是否存在同名的文件
public $exist_check

$filename_type public_oe property

文件命名法
public $filename_type

$max_height public_oe property

如果为0的话不压缩
public $max_height

$max_qulitity public_oe property

public $max_qulitity

$max_size public_oe property

public $max_size

$max_width public_oe property

限制上传文件的尺寸,如果超过尺寸,则压缩
public $max_width

$mimes public_oe property

public $mimes

$name_type public_oe property

允许上传的类型
public $name_type

$overwrite public_oe property

允许覆盖文件
public $overwrite

$shard_argv public_oe property

子目录生成参数
public $shard_argv

$shard_type public_oe property

子目录生成方法,可以使用randomkey,或者date
public $shard_type

$sub_dir public_oe property

指定子目录
public $sub_dir

$thumb_dir public_oe property

产生缩略图
public $thumb_dir

$thumb_height public_oe property

如果为0的话不生成缩略图
public $thumb_height

$thumb_qulitity public_oe property

public $thumb_qulitity

$thumb_width public_oe property

public $thumb_width