PHP Class Prado\Web\UI\ActiveControls\TActiveFileUpload

TActiveFileUpload 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. TActiveFileUpload raises {@link onFileUpload OnFileUpload} event if a file is uploaded (whether it succeeds or not). TActiveFileUpload actually does a postback in a hidden IFrame, and then does a callback. This callback then raises the {@link onFileUpload OnFileUpload} event. After the postback a status icon is displayed; either a green checkmark if the upload is successful, or a red x if there was an error. TActiveFileUpload needs either an application level cache or a security manager to work securely.
Author: Bradley Booms ([email protected])
Author: Christophe Boulain ([email protected])
Inheritance: extends Prado\Web\UI\WebControls\TFileUpload, implements Prado\Web\UI\ActiveControls\IActiveControl, implements Prado\Web\UI\ActiveControls\ICallbackEventHandler, implements Prado\Web\UI\INamingContainer
Datei anzeigen Open project: pradosoft/prado

Public Methods

Method Description
__construct ( ) Creates a new callback control, sets the adapter to TActiveControlAdapter. If you override this class, be sure to set the adapter appropriately by, for example, by calling this constructor.
addAttributesToRender ( $writer ) Adds ID attribute, and renders the javascript for active component.
createChildControls ( )
getActiveControl ( ) : TBaseActiveCallbackControl
getAutoPostBack ( ) : boolean
getBusyImage ( ) : TImage
getCallbackJavascript ( ) : string
getClientSide ( ) : TCallbackClientSide
getErrorImage ( ) : TImage
getSuccessImage ( ) : TImage
getTempPath ( ) : string
onFileUpload ( $param ) This method is invoked when a file is uploaded.
onInit ( $sender )
onPreRender ( $param ) Publish the javascript
onUnload ( $param ) Removes localfile on ending of the callback.
raiseCallbackEvent ( $param ) Raises OnFileUpload event.
raisePostDataChangedEvent ( ) Raises postdata changed event.
saveAs ( $fileName, $deleteTempFile = true ) : boolean Saves the uploaded file.
setAutoPostBack ( $value )
setTempPath ( $value )

Protected Methods

Method Description
getAssetUrl ( $file = '' ) : string
getClientClassName ( ) : string
getClientOptions ( ) : array Gets the client side options for this control.
popParamsByToken ( $token )
pushParamsAndGetToken ( TActiveFileUploadCallbackParams $params )

Method Details

__construct() public method

Creates a new callback control, sets the adapter to TActiveControlAdapter. If you override this class, be sure to set the adapter appropriately by, for example, by calling this constructor.
public __construct ( )

addAttributesToRender() public method

Adds ID attribute, and renders the javascript for active component.
public addAttributesToRender ( $writer )

createChildControls() public method

public createChildControls ( )

getActiveControl() public method

public getActiveControl ( ) : TBaseActiveCallbackControl
return TBaseActiveCallbackControl standard callback control options.

getAssetUrl() protected method

protected getAssetUrl ( $file = '' ) : string
return string asset file url.

getAutoPostBack() public method

public getAutoPostBack ( ) : boolean
return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true. Note: When set to false, you will need to trigger the callback yourself.

getBusyImage() public method

public getBusyImage ( ) : TImage
return Prado\Web\UI\WebControls\TImage the image displayed when an upload is in progress.

getCallbackJavascript() public method

public getCallbackJavascript ( ) : string
return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false}

getClientClassName() protected method

protected getClientClassName ( ) : string
return string corresponding javascript class name for this control.

getClientOptions() protected method

Gets the client side options for this control.
protected getClientOptions ( ) : array
return array ( inputID => input client ID, flagID => flag client ID, targetName => target unique ID, formID => form client ID, indicatorID => upload indicator client ID, completeID => complete client ID, errorID => error client ID)

getClientSide() public method

public getClientSide ( ) : TCallbackClientSide
return TCallbackClientSide client side request options.

getErrorImage() public method

public getErrorImage ( ) : TImage
return Prado\Web\UI\WebControls\TImage the image displayed when an upload does not complete successfully.

getSuccessImage() public method

public getSuccessImage ( ) : TImage
return Prado\Web\UI\WebControls\TImage the image displayed when an upload completes successfully.

getTempPath() public method

public getTempPath ( ) : string
return string the path where the uploaded file will be stored temporarily, in namespace format default "Application.runtime.*"

onFileUpload() public method

If you override this method, be sure to call the parent implementation to ensure the invocation of the attached event handlers.
public onFileUpload ( $param )

onInit() public method

public onInit ( $sender )

onPreRender() public method

Publish the javascript
public onPreRender ( $param )

onUnload() public method

Removes localfile on ending of the callback.
public onUnload ( $param )

popParamsByToken() protected method

protected popParamsByToken ( $token )

pushParamsAndGetToken() protected method

protected pushParamsAndGetToken ( TActiveFileUploadCallbackParams $params )
$params TActiveFileUploadCallbackParams

raiseCallbackEvent() public method

This method is required by {@link ICallbackEventHandler} interface. This method is mainly used by framework and control developers.
public raiseCallbackEvent ( $param )

raisePostDataChangedEvent() public method

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

saveAs() public method

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

setAutoPostBack() public method

public setAutoPostBack ( $value )

setTempPath() public method

public setTempPath ( $value )