\EditorMdUploader

Editor.md PHP上传类

Summary

Methods
Properties
Constants
__construct()
config()
upload()
getSaveName()
getFileExt()
redirect()
message()
$files
$fileExit
$saveName
$saveURL
$savePath
$formats
$maxSize
$cover
$redirect
$redirectURL
$errors
No constants found
No protected methods found
No protected properties found
N/A
uploadFile()
setSaveName()
No private properties found
N/A

Properties

$files

$files : 

Type

$fileExit

$fileExit : 

Type

$saveName

$saveName : 

Type

$saveURL

$saveURL : 

Type

$savePath

$savePath : 

Type

$formats

$formats : 

Type

$maxSize

$maxSize : 

Type

$cover

$cover : 

Type

$redirect

$redirect : 

Type

$redirectURL

$redirectURL : 

Type

$errors

$errors : 

Type

Methods

__construct()

__construct(string  $savePath, string  $saveURL, array  $formats, boolean  $cover = true, \Intiger  $maxSize = 1024) : \viod

构造函数,初始化对象

Parameters

string $savePath

最终保存的本地路径

string $saveURL

最终保存的URL地址

array $formats

允许上传的文件格式

boolean $cover

是否覆盖相同文件

\Intiger $maxSize

允许最大的上传文件大小,以KB为单位

Returns

\viod

config()

config(array  $configs) : void

配置参数函数

Parameters

array $configs

配置项数组

upload()

upload(string  $name) : boolean

执行文件上传

Parameters

string $name

fileInput's name

Returns

boolean —

返回是否上传成功的布尔值

getSaveName()

getSaveName() : string

取得保存的文件名,用于数据库存储

Returns

string

getFileExt()

getFileExt(  $fileName) : string

获取文件后缀名函数

Parameters

$fileName

Returns

string

redirect()

redirect() : void

上传成功或出错后跳转

message()

message(  $message,   $success) : void

错误提示函数

Parameters

$message
$success

uploadFile()

uploadFile() : boolean

上传文件

Returns

boolean

setSaveName()

setSaveName() : string

组成最终保存的完整路径及文件名

Returns

string —

$this->saveName 返回生成的文件名字符串