\libUpload

文件上传类 Class Upload

Summary

Methods
Properties
Constants
__construct()
getFile()
setTid()
setFile()
checkDisabledFile()
checkMimeType()
checkSize()
getSuffix()
getSavekey()
upload()
No public properties found
No constants found
No protected methods found
$mergin
$config
$file
$fileInfo
$tid
N/A
No private methods found
No private properties found
N/A

Properties

$mergin

$mergin : bool

分片上传是否需要合并

Type

bool

$config

$config

$file

$file : \app\api\model\File

Type

File

$fileInfo

$fileInfo

$tid

$tid

Methods

__construct()

__construct(mixed  $file = null, mixed  $tid = null) : mixed

Parameters

mixed $file
mixed $tid

Returns

mixed —

getFile()

getFile() : \app\api\model\File|null

获取文件

Returns

\app\api\model\File|null —

setTid()

setTid(int  $tid) : mixed

设置类别id

Parameters

int $tid

Throws

\think\Exception

Returns

mixed —

setFile()

setFile( $file) : mixed

设置文件

Parameters

$file

Throws

\think\Exception

Returns

mixed —

checkDisabledFile()

checkDisabledFile() : bool

检测上传文件是否为php和html文件

Throws

\think\Exception

Returns

bool —

checkMimeType()

checkMimeType() : bool

检测文件类型

Throws

\think\Exception

Returns

bool —

checkSize()

checkSize() : mixed

检测文件大小是否超出限制

Throws

\think\Exception

Returns

mixed —

getSuffix()

getSuffix() : string

获取文件后缀

Returns

string —

getSavekey()

getSavekey(null  $savekey = null, null  $filename = null, null  $md5 = null) : mixed|string|string[]

获取存储的文件名

Parameters

null $savekey
null $filename
null $md5

Returns

mixed|string|string[] —

upload()

upload(null  $savekey = null) : \app\api\model\File

普通文件上传

Parameters

null $savekey

Throws

\think\Exception
\think\exception\DbException

Returns

\app\api\model\File —