PHP Class zgldh\UploadManager\UploadManager

User: zgldh Date: 2015/7/23 Time: 16:50
ファイルを表示 Open project: zgldh/laravel-upload-manager Class Usage Examples

Public Methods

Method Description
__construct ( )
getErrors ( ) : null
getFirstErrorMessage ( ) : mixed 得到第一个错误信息
getInstance ( ) : UploadManager
getStrategy ( ) : zgldh\UploadManager\UploadStrategyInterface
getUploadUrl ( $disk, $path ) : string 得到已上传文件的URL
storeErrors ( zgldh\UploadManager\UploadException $e )
update ( &$upload, Symfony\Component\HttpFoundation\File\UploadedFile $file, null $preCallback = null ) : boolean 用已上传文件更新一个上传对象
updateByUrl ( &$upload, $url, null $preCallback = null ) : boolean 用URL更新一个上传对象
upload ( $file, null $preCallback = null ) : Upload | boolean 保存上传文件,生成上传对象
uploadByUrl ( $url, null $preCallback = null ) : Upload | boolean 从URL获取文件并保存,生成上传对象
withDisk ( $diskName = null ) 设置默认disk名字
withValidator ( $validatorGroups ) 设置验证机制, 要在upload、update之前调用

Private Methods

Method Description
coreUpload ( $upload, $uploadedFilePath, $file, $preCallback ) : boolean 核心上传
newUploadModel ( )
removeOldFile ( $disk, $path )

Method Details

__construct() public method

public __construct ( )

getErrors() public method

public getErrors ( ) : null
return null

getFirstErrorMessage() public method

得到第一个错误信息
public getFirstErrorMessage ( ) : mixed
return mixed

getInstance() public static method

public static getInstance ( ) : UploadManager
return UploadManager

getStrategy() public static method

public static getStrategy ( ) : zgldh\UploadManager\UploadStrategyInterface
return zgldh\UploadManager\UploadStrategyInterface

getUploadUrl() public method

得到已上传文件的URL
public getUploadUrl ( $disk, $path ) : string
$disk
$path
return string

storeErrors() public method

public storeErrors ( zgldh\UploadManager\UploadException $e )
$e zgldh\UploadManager\UploadException

update() public method

用已上传文件更新一个上传对象
public update ( &$upload, Symfony\Component\HttpFoundation\File\UploadedFile $file, null $preCallback = null ) : boolean
$upload
$file Symfony\Component\HttpFoundation\File\UploadedFile
$preCallback null
return boolean

updateByUrl() public method

用URL更新一个上传对象
public updateByUrl ( &$upload, $url, null $preCallback = null ) : boolean
$upload
$url
$preCallback null
return boolean

upload() public method

保存上传文件,生成上传对象
public upload ( $file, null $preCallback = null ) : Upload | boolean
$file
$preCallback null
return Upload | boolean

uploadByUrl() public method

从URL获取文件并保存,生成上传对象
public uploadByUrl ( $url, null $preCallback = null ) : Upload | boolean
$url
$preCallback null
return Upload | boolean

withDisk() public method

设置默认disk名字
public withDisk ( $diskName = null )
$diskName config/filesystems.php disks数组内的key

withValidator() public method

设置验证机制, 要在upload、update之前调用
public withValidator ( $validatorGroups )
$validatorGroups 验证组的名字