## Class TActiveFileUpload

Description

Implements interfaces:

- IActiveControl
- ICallbackEventHandler
- INamingContainer

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 HasFile indicates whether the file upload is successful. If successful, the file may be obtained by calling saveAs to save it at a specified place. You can use FileName, FileType, FileSize to get the original client-side file name, the file mime type, and the file size information. If the upload is not successful, ErrorCode contains the error code describing the cause of failure.

TActiveFileUpload raises 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 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.

- version: $Id: TActiveFileUpload.php 2773 2010-02-17 13:55:18Z Christophe.Boulain $
- author: Bradley Booms <Bradley.Booms@nsighttel.com>
- author: Christophe Boulain <Christophe.Boulain@gmail.com>

Located in /Web/UI/ActiveControls/TActiveFileUpload.php (line 44)

    TComponent
       |
       --TApplicationComponent
          |
          --TControl
             |
             --TWebControl
                |
                --TFileUpload
                   |
                   --TActiveFileUpload

Class Constant Summary
SCRIPT_PATH = 'prado/activefileupload'
Method Summary
TActiveFileUpload __construct ()
void addAttributesToRender (THtmlWriter $writer)
void createChildControls ()
TBaseActiveCallbackControl getActiveControl ()
string getAssetUrl ([string $file = ''])
boolean getAutoPostBack ()
TImage getBusyImage ()
string getCallbackJavascript ()
string getClientClassName ()
array getClientOptions ()
TImage getErrorImage ()
TImage getSuccessImage ()
string getTempPath ()
void onFileUpload (TEventParameter $param)
void onInit (mixed $sender)
void onPreRender (mixed $param)
void onUnload (mixed $param)
void raiseCallbackEvent (TCallbackEventParameter $param)
boolean saveAs (string $fileName, [boolean $deleteTempFile = true])
void setAutoPostBack (boolean $value)
void setTempPath (string $value)
Methods
Constructor __construct (line 76)

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.

- access: public

TActiveFileUpload __construct ()

Redefinition of:

TControl::__construct()
  Constructor.

addAttributesToRender (line 258)

Adds ID attribute, and renders the javascript for active component.

- access: public

void addAttributesToRender (THtmlWriter $writer)

- THtmlWriter $writer: the writer used for the rendering purpose

Redefinition of:

TFileUpload::addAttributesToRender()
  Sets name attribute to the unique ID of the control.

createChildControls (line 203)

- access: public

void createChildControls ()

Redefinition of:

TControl::createChildControls()
  Creates child controls.

getActiveControl (line 250)

- return: standard callback control options.
- access: public

TBaseActiveCallbackControl getActiveControl ()
getAssetUrl (line 86)

- return: asset file url.
- access: protected

string getAssetUrl ([string $file = ''])

- string $file: asset file in the self::SCRIPT_PATH directory.

getAutoPostBack (line 143)

- return: 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.
- access: public

boolean getAutoPostBack ()
getBusyImage (line 336)

- return: the image displayed when an upload is in progress.
- access: public

TImage getBusyImage ()
getCallbackJavascript (line 158)

- return: A chuck of javascript that will need to be called if {AutoPostBack is set to false}
- access: public

string getCallbackJavascript ()
getClientClassName (line 268)

- return: corresponding javascript class name for this control.
- access: protected

string getClientClassName ()
getClientOptions (line 282)

Gets the client side options for this control.

- return: ( 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)
- access: protected

array getClientOptions ()
getErrorImage (line 327)

- return: the image displayed when an upload does not complete successfully.
- access: public

TImage getErrorImage ()
getSuccessImage (line 318)

- return: the image displayed when an upload completes successfully.
- access: public

TImage getSuccessImage ()
getTempPath (line 127)

- return: the path where the uploaded file will be stored temporarily, in namespace format default "Application.runtime.*"
- access: public

string getTempPath ()
onFileUpload (line 99)

This method is invoked when a file is uploaded.

If you override this method, be sure to call the parent implementation to ensure the invocation of the attached event handlers.

- access: public

void onFileUpload (TEventParameter $param)

- TEventParameter $param: event parameter to be passed to the event handlers

Redefinition of:

TFileUpload::onFileUpload()
  This method is invoked when a file is uploaded during a postback.

onInit (line 165)

- access: public
- throws: TInvalidDataValueException if the TempPath is not writable.

void onInit (mixed $sender)

Redefinition of:

TControl::onInit()
  This method is invoked when the control enters 'OnInit' stage.

onPreRender (line 196)

Publish the javascript

- access: public

void onPreRender (mixed $param)

Redefinition of:

TFileUpload::onPreRender()
  Sets Enctype of the form on the page.

onUnload (line 238)

Removes localfile on ending of the callback.

- access: public

void onUnload (mixed $param)

Redefinition of:

TControl::onUnload()
  This method is invoked when the control enters 'OnUnload' stage.

raiseCallbackEvent (line 179)

Raises OnFileUpload event.

This method is required by ICallbackEventHandler interface. This method is mainly used by framework and control developers.

- access: public

void raiseCallbackEvent (TCallbackEventParameter $param)

- TCallbackEventParameter $param: the event parameter

saveAs (line 304)

Saves the uploaded file.

- return: true if the file saving is successful
- access: public

boolean saveAs (string $fileName, [boolean $deleteTempFile = true])

- string $fileName: the file name used to save the uploaded file
- boolean $deleteTempFile: whether to delete the temporary file after saving. If true, you will not be able to save the uploaded file again.

Redefinition of:

TFileUpload::saveAs()
  Saves the uploaded file.

setAutoPostBack (line 151)

- access: public

void setAutoPostBack (boolean $value)

- boolean $value: 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.

setTempPath (line 135)

- access: public

void setTempPath (string $value)

- string $value: the path where the uploaded file will be stored temporarily in namespace format default "Application.runtime.*"

#### Inherited Methods

Inherited From TFileUpload

> TFileUpload::addAttributesToRender()
> TFileUpload::getDataChanged()
> TFileUpload::getErrorCode()
> TFileUpload::getFileName()
> TFileUpload::getFileSize()
> TFileUpload::getFileType()
> TFileUpload::getHasFile()
> TFileUpload::getIsValid()
> TFileUpload::getLocalName()
> TFileUpload::getMaxFileSize()
> TFileUpload::getTagName()
> TFileUpload::getValidationPropertyValue()
> TFileUpload::loadPostData()
> TFileUpload::onFileUpload()
> TFileUpload::onPreRender()
> TFileUpload::raisePostDataChangedEvent()
> TFileUpload::saveAs()
> TFileUpload::setIsValid()
> TFileUpload::setMaxFileSize()

Inherited From TWebControl

> TWebControl::addAttributesToRender()
> TWebControl::clearStyle()
> TWebControl::copyBaseAttributes()
> TWebControl::createStyle()
> TWebControl::getAccessKey()
> TWebControl::getBackColor()
> TWebControl::getBorderColor()
> TWebControl::getBorderStyle()
> TWebControl::getBorderWidth()
> TWebControl::getCssClass()
> TWebControl::getDisplay()
> TWebControl::getFont()
> TWebControl::getForeColor()
> TWebControl::getHasStyle()
> TWebControl::getHeight()
> TWebControl::getStyle()
> TWebControl::getTabIndex()
> TWebControl::getTagName()
> TWebControl::getToolTip()
> TWebControl::getWidth()
> TWebControl::render()
> TWebControl::renderBeginTag()
> TWebControl::renderContents()
> TWebControl::renderEndTag()
> TWebControl::setAccessKey()
> TWebControl::setBackColor()
> TWebControl::setBorderColor()
> TWebControl::setBorderStyle()
> TWebControl::setBorderWidth()
> TWebControl::setCssClass()
> TWebControl::setDisplay()
> TWebControl::setForeColor()
> TWebControl::setHeight()
> TWebControl::setStyle()
> TWebControl::setTabIndex()
> TWebControl::setToolTip()
> TWebControl::setWidth()

Inherited From TControl

> TControl::__construct()
> TControl::addedControl()
> TControl::addParsedObject()
> TControl::addToPostDataLoader()
> TControl::applyStyleSheetSkin()
> TControl::autoBindProperty()
> TControl::autoDataBindProperties()
> TControl::bindProperty()
> TControl::broadcastEvent()
> TControl::bubbleEvent()
> TControl::clearChildState()
> TControl::clearControlState()
> TControl::clearNamingContainer()
> TControl::clearViewState()
> TControl::convertUniqueIdToClientId()
> TControl::createChildControls()
> TControl::createControlCollection()
> TControl::dataBind()
> TControl::dataBindChildren()
> TControl::dataBindProperties()
> TControl::ensureChildControls()
> TControl::findControl()
> TControl::findControlsByID()
> TControl::findControlsByType()
> TControl::focus()
> TControl::getAdapter()
> TControl::getAllowChildControls()
> TControl::getAttribute()
> TControl::getAttributes()
> TControl::getChildControlsCreated()
> TControl::getClientID()
> TControl::getControls()
> TControl::getControlStage()
> TControl::getControlState()
> TControl::getCustomData()
> TControl::getEnabled()
> TControl::getEnableTheming()
> TControl::getEnableViewState()
> TControl::getHasAdapter()
> TControl::getHasAttributes()
> TControl::getHasChildInitialized()
> TControl::getHasControls()
> TControl::getHasInitialized()
> TControl::getHasLoaded()
> TControl::getHasLoadedPostData()
> TControl::getHasPreRendered()
> TControl::getID()
> TControl::getNamingContainer()
> TControl::getPage()
> TControl::getParent()
> TControl::getRegisteredObject()
> TControl::getSkinID()
> TControl::getSourceTemplateControl()
> TControl::getTemplateControl()
> TControl::getUniqueID()
> TControl::getViewState()
> TControl::getVisible()
> TControl::hasAttribute()
> TControl::initRecursive()
> TControl::isDescendentOf()
> TControl::isObjectRegistered()
> TControl::loadRecursive()
> TControl::loadState()
> TControl::loadStateRecursive()
> TControl::onDataBinding()
> TControl::onInit()
> TControl::onLoad()
> TControl::onPreRender()
> TControl::onUnload()
> TControl::preRenderRecursive()
> TControl::raiseBubbleEvent()
> TControl::registerObject()
> TControl::removeAttribute()
> TControl::removedControl()
> TControl::render()
> TControl::renderChildren()
> TControl::renderControl()
> TControl::saveState()
> TControl::saveStateRecursive()
> TControl::setAdapter()
> TControl::setAttribute()
> TControl::setChildControlsCreated()
> TControl::setControlStage()
> TControl::setControlState()
> TControl::setCustomData()
> TControl::setEnabled()
> TControl::setEnableTheming()
> TControl::setEnableViewState()
> TControl::setID()
> TControl::setPage()
> TControl::setSkinID()
> TControl::setTemplateControl()
> TControl::setViewState()
> TControl::setVisible()
> TControl::trackViewState()
> TControl::traverseChildControls()
> TControl::unbindProperty()
> TControl::unloadRecursive()
> TControl::unregisterObject()
> TControl::__get()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Class Constants
SCRIPT_PATH = 'prado/activefileupload' (line 47)

#### Inherited Constants

Inherited from TFileUpload

> TFileUpload::MAX_FILE_SIZE

Inherited from TControl

> TControl::AUTOMATIC_ID_PREFIX
> TControl::CLIENT_ID_SEPARATOR
> TControl::CS_CHILD_INITIALIZED
> TControl::CS_CONSTRUCTED
> TControl::CS_INITIALIZED
> TControl::CS_LOADED
> TControl::CS_PRERENDERED
> TControl::CS_STATE_LOADED
> TControl::ID_FORMAT
> TControl::ID_SEPARATOR
> TControl::IS_CHILD_CREATED
> TControl::IS_CREATING_CHILD
> TControl::IS_DISABLE_THEMING
> TControl::IS_DISABLE_VIEWSTATE
> TControl::IS_ID_SET
> TControl::IS_SKIN_APPLIED
> TControl::IS_STYLESHEET_APPLIED
> TControl::RF_ADAPTER
> TControl::RF_AUTO_BINDINGS
> TControl::RF_CHILD_STATE
> TControl::RF_CONTROLS
> TControl::RF_CONTROLSTATE
> TControl::RF_DATA_BINDINGS
> TControl::RF_EVENTS
> TControl::RF_NAMED_CONTROLS
> TControl::RF_NAMED_CONTROLS_ID
> TControl::RF_NAMED_OBJECTS
> TControl::RF_SKIN_ID

Documentation generated on Mon, 22 Feb 2010 12:16:15 +0000 by phpDocumentor 1.3.0RC4