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 = ''])
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 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 234)

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

Redefinition of:
TControl::createChildControls()
Creates child controls.
getActiveControl (line 226)
  • 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.
getBusyImage (line 311)
  • return: the image displayed when an upload is in progress.
  • access: public
TImage getBusyImage ()
getClientClassName (line 244)
  • return: corresponding javascript class name for this control.
  • access: protected
string getClientClassName ()
getClientOptions (line 258)

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 302)
  • return: the image displayed when an upload does not complete successfully.
  • access: public
TImage getErrorImage ()
getSuccessImage (line 293)
  • 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 141)
  • 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 172)

Publish the javascript

  • access: public
void onPreRender (mixed $param)

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

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

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

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.
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, 11 Jan 2009 20:15:34 -0500 by phpDocumentor 1.3.0RC4