PHP 클래스 Gdn_Upload, vanilla

상속: extends Gdn_Pluggable
파일 보기 프로젝트 열기: vanilla/vanilla 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_AllowedFileExtensions array
$_MaxFileSize integer
$_UploadedFile string

공개 메소드들

메소드 설명
__construct ( ) Class constructor.
allowFileExtension ( $Extension ) Adds an extension (or array of extensions) to the array of allowed file extensions.
canUpload ( null $UploadPath = null ) : boolean
clear ( )
copyLocal ( string $Name ) : string Copy an upload locally so that it can be operated on.
delete ( string $Name ) : boolean Delete an uploaded file.
formatFileSize ( integer $Bytes, integer $Precision = 1 ) : string Format a number of bytes with the largest unit.
generateTargetName ( $TargetFolder, string $Extension = 'jpg', boolean $Chunk = false ) : string
getUploadedFileExtension ( ) : mixed
getUploadedFileName ( ) : mixed
isUpload ( $inputName ) : boolean Check to see whether the user has selected a file for uploading.
isUploadUri ( string $uri ) : boolean Determine if a URI matches the format of a valid type/domain upload.
parse ( string $Name ) : array | boolean Parse a virtual filename that had previously been saved to the database.
saveAs ( $Source, $Target, array $Options = [] ) : array | boolean
unformatFileSize ( string $Formatted ) : integer Take a string formatted filesize and return the number of bytes.
url ( $Name ) : mixed
urls ( string $Type = null ) : string Returns the url prefix for a given type.
validateUpload ( $InputName, $ThrowException = true ) Validates the uploaded file. Returns the temporary name of the uploaded file.

메소드 상세

__construct() 공개 메소드

Class constructor.
public __construct ( )

allowFileExtension() 공개 메소드

Adds an extension (or array of extensions) to the array of allowed file extensions.
public allowFileExtension ( $Extension )

canUpload() 공개 정적인 메소드

public static canUpload ( null $UploadPath = null ) : boolean
$UploadPath null
리턴 boolean

clear() 공개 메소드

public clear ( )

copyLocal() 공개 메소드

Copy an upload locally so that it can be operated on.
public copyLocal ( string $Name ) : string
$Name string Filename to be copied.
리턴 string Local file path.

delete() 공개 메소드

Delete an uploaded file.
public delete ( string $Name ) : boolean
$Name string The name of the upload as saved in the database.
리턴 boolean

formatFileSize() 공개 정적인 메소드

Format a number of bytes with the largest unit.
public static formatFileSize ( integer $Bytes, integer $Precision = 1 ) : string
$Bytes integer The number of bytes.
$Precision integer The number of decimal places in the formatted number.
리턴 string the formatted filesize.

generateTargetName() 공개 메소드

public generateTargetName ( $TargetFolder, string $Extension = 'jpg', boolean $Chunk = false ) : string
$TargetFolder
$Extension string
$Chunk boolean
리턴 string

getUploadedFileExtension() 공개 메소드

public getUploadedFileExtension ( ) : mixed
리턴 mixed

getUploadedFileName() 공개 메소드

public getUploadedFileName ( ) : mixed
리턴 mixed

isUpload() 공개 메소드

Check to see whether the user has selected a file for uploading.
public isUpload ( $inputName ) : boolean
$inputName The input name of the file.
리턴 boolean Whether a file has been selected for the fiels.

isUploadUri() 공개 정적인 메소드

Determine if a URI matches the format of a valid type/domain upload.
public static isUploadUri ( string $uri ) : boolean
$uri string The URI to test. This would be the value saved in the database (ex. GDN_User.Photo).
리턴 boolean Returns **true** if {@link uri} looks like an uploaded file or **false** otherwise.

parse() 공개 정적인 메소드

There are various formats supported for the name, mostly due to legacy concerns. - http(s)://domain/path.ext: A fully qualified url. - /path/from/uploads.ext: This is a locally uploaded file. - /path/to/uploads/path.ext: A full path starting from the uploads directory (deprecated). - ~type/path.ext: A specific type of upload provided by a plugin (deprecated). - type://domain/path.ext: A specific type of upload provied by a plugin with additional domain information.
public static parse ( string $Name ) : array | boolean
$Name string The virtual name of the file.
리턴 array | boolean Returns an array of parsed information or false if the parse failed.

saveAs() 공개 메소드

public saveAs ( $Source, $Target, array $Options = [] ) : array | boolean
$Source
$Target
$Options array
리턴 array | boolean

unformatFileSize() 공개 정적인 메소드

Take a string formatted filesize and return the number of bytes.
public static unformatFileSize ( string $Formatted ) : integer
$Formatted string The formatted filesize.
리턴 integer The number of bytes in the string.

url() 공개 정적인 메소드

public static url ( $Name ) : mixed
$Name
리턴 mixed

urls() 공개 정적인 메소드

If there is a plugin that wants to store uploads at a different location or in a different way then they register themselves by subscribing to the Gdn_Upload_GetUrls_Handler event. After that they will be available here.
public static urls ( string $Type = null ) : string
$Type string The type of upload to get the prefix for.
리턴 string The url prefix.

validateUpload() 공개 메소드

Validates the uploaded file. Returns the temporary name of the uploaded file.
public validateUpload ( $InputName, $ThrowException = true )

프로퍼티 상세

$_AllowedFileExtensions 보호되어 있는 프로퍼티

protected array $_AllowedFileExtensions
리턴 array

$_MaxFileSize 보호되어 있는 프로퍼티

protected int $_MaxFileSize
리턴 integer

$_UploadedFile 보호되어 있는 프로퍼티

protected string $_UploadedFile
리턴 string