PHP Class zgldh\UploadManager\UploadManager

User: zgldh Date: 2015/7/23 Time: 16:50
Afficher le fichier Open project: zgldh/laravel-upload-manager Class Usage Examples

Méthodes publiques

Méthode 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

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

Method Details

__construct() public méthode

public __construct ( )

getErrors() public méthode

public getErrors ( ) : null
Résultat null

getFirstErrorMessage() public méthode

得到第一个错误信息
public getFirstErrorMessage ( ) : mixed
Résultat mixed

getInstance() public static méthode

public static getInstance ( ) : UploadManager
Résultat UploadManager

getStrategy() public static méthode

public static getStrategy ( ) : zgldh\UploadManager\UploadStrategyInterface
Résultat zgldh\UploadManager\UploadStrategyInterface

getUploadUrl() public méthode

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

storeErrors() public méthode

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

update() public méthode

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

updateByUrl() public méthode

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

upload() public méthode

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

uploadByUrl() public méthode

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

withDisk() public méthode

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

withValidator() public méthode

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