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

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 (mixed $sender)
void onPreRender (mixed $param)
void onUnload (mixed $param)
boolean saveAs (string $fileName, [boolean $deleteTempFile = true])
void setAutoPostBack (boolean $value)
void setTempPath (string $value)
Methods
Constructor __construct (line 75)

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

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

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

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 326)
  • return: the image displayed when an upload does not complete successfully.
  • access: public
TImage getErrorImage ()
getSuccessImage (line 317)
  • return: the image displayed when an upload completes successfully.
  • access: public
TImage getSuccessImage ()
getTempPath (line 126)
  • return: the path where the uploaded file will be stored temporarily, in namespace format default "Application.runtime.*"
  • access: public
string getTempPath ()
onFileUpload (line 98)

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 164)
  • 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 195)

Publish the javascript

  • access: public
void onPreRender (mixed $param)

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

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

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)
saveAs (line 303)

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 150)
  • 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 134)
  • 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

Documentation generated on Sun, 24 May 2009 16:40:19 -0400 by phpDocumentor 1.3.0RC4