PHP 클래스 Prado\Web\UI\WebControls\TFileUpload

TFileUpload displays a file upload field on a page. Upon postback, the text entered into the field will be treated as the name of the file that will be uploaded to the server. The property {@link getHasFile HasFile} indicates whether the file upload is successful. If successful, the file may be obtained by calling {@link saveAs} to save it at a specified place. You can use {@link getFileName FileName}, {@link getFileType FileType}, {@link getFileSize FileSize} to get the original client-side file name, the file mime type, and the file size information. If the upload is not successful, {@link getErrorCode ErrorCode} contains the error code describing the cause of failure. TFileUpload raises {@link onFileUpload OnFileUpload} event if a file is uploaded (whether it succeeds or not).
부터: 3.0
상속: extends TWebControl, implements Prado\Web\UI\IPostBackDataHandler, implements Prado\Web\UI\IValidatable
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_errorCode error code of the current file upload
$_localName the name of the temporary file storing the uploaded file

공개 메소드들

메소드 설명
getDataChanged ( ) : boolean Returns a value indicating whether postback has caused the control data change.
getErrorCode ( ) : integer Returns an error code describing the status of this file uploading.
getFileName ( ) : string
getFileSize ( ) : integer
getFileType ( ) : string
getHasFile ( ) : boolean
getIsValid ( ) : boolean Returns true if this control validated successfully.
getLocalName ( ) : string
getMaxFileSize ( ) : integer
getValidationPropertyValue ( ) : mixed Returns the original file name as the property value to be validated.
loadPostData ( $key, $values ) : boolean Loads user input data.
onFileUpload ( $param ) This method is invoked when a file is uploaded during a postback.
onPreRender ( $param ) Sets Enctype of the form on the page.
raisePostDataChangedEvent ( ) Raises postdata changed event.
saveAs ( $fileName, $deleteTempFile = true ) : boolean Saves the uploaded file.
setIsValid ( $value )
setMaxFileSize ( $size ) Sets the maximum size that a file can be uploaded.

보호된 메소드들

메소드 설명
addAttributesToRender ( $writer ) Sets name attribute to the unique ID of the control.
getTagName ( ) : string

메소드 상세

addAttributesToRender() 보호된 메소드

This method overrides the parent implementation with additional file update control specific attributes.
protected addAttributesToRender ( $writer )

getDataChanged() 공개 메소드

This method is required by the \Prado\Web\UI\IPostBackDataHandler interface.
public getDataChanged ( ) : boolean
리턴 boolean whether postback has caused the control data change. False if the page is not in postback mode.

getErrorCode() 공개 메소드

Returns an error code describing the status of this file uploading.
또한 보기: http://www.php.net/manual/en/features.file-upload.errors.php
public getErrorCode ( ) : integer
리턴 integer the error code

getFileName() 공개 메소드

public getFileName ( ) : string
리턴 string the original full path name of the file on the client machine

getFileSize() 공개 메소드

public getFileSize ( ) : integer
리턴 integer the actual size of the uploaded file in bytes

getFileType() 공개 메소드

public getFileType ( ) : string
리턴 string the MIME-type of the uploaded file (such as "image/gif"). This mime type is not checked on the server side and do not take its value for granted.

getHasFile() 공개 메소드

public getHasFile ( ) : boolean
리턴 boolean whether the file is uploaded successfully

getIsValid() 공개 메소드

Defaults to true.
public getIsValid ( ) : boolean
리턴 boolean wether this control validated successfully.

getLocalName() 공개 메소드

public getLocalName ( ) : string
리턴 string the local name of the file (where it is after being uploaded). Note, PHP will delete this file automatically after finishing this round of request.

getMaxFileSize() 공개 메소드

또한 보기: setMaxFileSize
public getMaxFileSize ( ) : integer
리턴 integer the maximum file size, defaults to 1MB (1048576 bytes).

getTagName() 보호된 메소드

protected getTagName ( ) : string
리턴 string tag name of the file upload control

getValidationPropertyValue() 공개 메소드

This method is required by \Prado\Web\UI\IValidatable property.
public getValidationPropertyValue ( ) : mixed
리턴 mixed the property value to be validated

loadPostData() 공개 메소드

This method is primarly used by framework developers.
public loadPostData ( $key, $values ) : boolean
리턴 boolean whether the data of the control has been changed

onFileUpload() 공개 메소드

The method raises OnFileUpload event to fire up the event handler. If you override this method, be sure to call the parent implementation so that the event delegates can be invoked.
public onFileUpload ( $param )

onPreRender() 공개 메소드

This method overrides the parent implementation and is invoked before render.
public onPreRender ( $param )

raisePostDataChangedEvent() 공개 메소드

This method calls {@link onFileUpload} method. This method is primarly used by framework developers.

saveAs() 공개 메소드

Saves the uploaded file.
public saveAs ( $fileName, $deleteTempFile = true ) : boolean
리턴 boolean true if the file saving is successful

setIsValid() 공개 메소드

public setIsValid ( $value )

setMaxFileSize() 공개 메소드

Note, this is an advisory value to the browser. Sets this property with a reasonably large size to save users the trouble of waiting for a big file being transferred only to find that it was too big and the transfer failed.
public setMaxFileSize ( $size )

프로퍼티 상세

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

error code of the current file upload
protected $_errorCode

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

the name of the temporary file storing the uploaded file
protected $_localName