Class TActiveFileUpload

Description

Implements interfaces:

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.

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

TComponent
   |
   --TApplicationComponent
      |
      --TControl
         |
         --TWebControl
            |
            --TFileUpload
               |
               --TActiveFileUpload
Class Constant Summary
 SCRIPT_PATH = 'prado/activefileupload'
Method Summary
TActiveFileUpload __construct ()
string getAssetUrl ([string $file = ''])
boolean getAutoPostBack ()
string getClientClassName ()
array getClientOptions ()
string getTempPath ()
void onFileUpload (TEventParameter $param)
void onInit ( $sender)
void onPreRender ( $param)
void onUnload ( $param)
void popParamsByToken ( $token)
boolean saveAs (string $fileName, [boolean $deleteTempFile = true])
void setAutoPostBack (boolean $value)
void setTempPath (string $value)
Variables

Inherited Variables

Inherited from TFileUpload

TFileUpload::$_errorCode

Inherited from TWebControl

TWebControl::$_decorator
Methods
Constructor __construct (line 77)

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 367)

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 304)
  • access: public
void createChildControls ()

Redefinition of:
TControl::createChildControls()
Creates child controls.
getActiveControl (line 351)
  • return: standard callback control options.
  • access: public
TBaseActiveCallbackControl getActiveControl ()
getAssetUrl (line 87)
  • return: asset file url.
  • access: protected
string getAssetUrl ([string $file = ''])
  • string $file: asset file in the self::SCRIPT_PATH directory.
getAutoPostBack (line 156)
  • 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 446)
  • return: the image displayed when an upload is in progress.
  • access: public
TImage getBusyImage ()
getCallbackJavascript (line 171)
  • return: A chuck of javascript that will need to be called if {AutoPostBack is set to false}
  • access: public
string getCallbackJavascript ()
getClientClassName (line 378)
  • return: corresponding javascript class name for this control.
  • access: protected
string getClientClassName ()
getClientOptions (line 392)

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 ()
getClientSide (line 358)
  • return: client side request options.
  • access: public
TCallbackClientSide getClientSide ()
getErrorImage (line 437)
  • return: the image displayed when an upload does not complete successfully.
  • access: public
TImage getErrorImage ()
getSuccessImage (line 428)
  • return: the image displayed when an upload completes successfully.
  • access: public
TImage getSuccessImage ()
getTempPath (line 140)
  • return: the path where the uploaded file will be stored temporarily, in namespace format default "Application.runtime.*"
  • access: public
string getTempPath ()
onFileUpload (line 100)

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 178)
  • throws: TInvalidDataValueException if the TempPath is not writable.
  • access: public
void onInit ( $sender)
  • $sender

Redefinition of:
TControl::onInit()
This method is invoked when the control enters 'OnInit' stage.
onPreRender (line 270)

Publish the javascript

  • access: public
void onPreRender ( $param)
  • $param

Redefinition of:
TFileUpload::onPreRender()
Sets Enctype of the form on the page.
onUnload (line 339)

Removes localfile on ending of the callback.

  • access: public
void onUnload ( $param)
  • $param

Redefinition of:
TControl::onUnload()
This method is invoked when the control enters 'OnUnload' stage.
popParamsByToken (line 244)
  • access: protected
void popParamsByToken ( $token)
  • $token
pushParamsAndGetToken (line 224)
  • access: protected
void pushParamsAndGetToken (TActiveFileUploadCallbackParams $params)
raiseCallbackEvent (line 197)

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)
raisePostDataChangedEvent (line 219)

Raises postdata changed event.

This method calls onFileUpload method This method is primarily used by framework developers.

  • access: public
void raisePostDataChangedEvent ()

Redefinition of:
TFileUpload::raisePostDataChangedEvent()
Raises postdata changed event.
saveAs (line 414)

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 164)
  • 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 148)
  • 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::getDecorator()
TWebControl::getDisplay()
TWebControl::getEnsureId()
TWebControl::getFont()
TWebControl::getForeColor()
TWebControl::getHasStyle()
TWebControl::getHeight()
TWebControl::getStyle()
TWebControl::getTabIndex()
TWebControl::getTagName()
TWebControl::getToolTip()
TWebControl::getWidth()
TWebControl::onPreRender()
TWebControl::render()
TWebControl::renderBeginTag()
TWebControl::renderContents()
TWebControl::renderEndTag()
TWebControl::setAccessKey()
TWebControl::setBackColor()
TWebControl::setBorderColor()
TWebControl::setBorderStyle()
TWebControl::setBorderWidth()
TWebControl::setCssClass()
TWebControl::setDisplay()
TWebControl::setEnsureId()
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::getIsSkinApplied()
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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()
Class Constants

Documentation generated on Mon, 25 Jun 2012 14:37:00 +0200 by phpDocumentor 1.4.3