|
Class TActiveFileUpload
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 getHasFile HasFile indicates
whether the file upload is successful. If successful, the file may be obtained
by calling TActiveFileUpload::saveAs() to save it at a specified place. You can use getFileName FileName, getFileType FileType, 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, getErrorCode
ErrorCode contains the error code describing the cause of failure.
TActiveFileUpload raises 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 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.
-
TComponent
-
TApplicationComponent
-
TControl
implements
IRenderable,
IBindable
-
TWebControl
implements
IStyleable
-
TFileUpload
implements
IPostBackDataHandler,
IValidatable
-
TActiveFileUpload
implements
IActiveControl,
ICallbackEventHandler,
INamingContainer
Methods summary
public
|
#
__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.
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.
Overrides
|
protected
string
|
#
getAssetUrl( string $file = '' )
Parameters
- $file
string asset file in the self::SCRIPT_PATH directory.
Returns
string asset file url.
|
public
|
#
onFileUpload( TEventParameter $param )
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.
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.
Parameters
Overrides
|
public
string
|
#
getTempPath( )
Returns
string the path where the uploaded file will be stored temporarily, in namespace format
default "Application.runtime.*"
|
public
|
#
setTempPath( string $value )
Parameters
- $value
string the path where the uploaded file will be stored temporarily in namespace format
default "Application.runtime.*"
|
public
boolean
|
#
getAutoPostBack( )
Returns
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.
|
public
|
#
setAutoPostBack( boolean $value )
Parameters
- $value
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.
|
public
string
|
#
getCallbackJavascript( )
Returns
string A chuck of javascript that will need to be called if {getAutoPostBack
AutoPostBack is set to false}
|
public
|
|
public
|
#
raiseCallbackEvent( TCallbackEventParameter $param )
Raises OnFileUpload event.
Raises OnFileUpload event.
This method is required by ICallbackEventHandler interface. This
method is mainly used by framework and control developers.
Parameters
Implementation of
|
public
|
#
raisePostDataChangedEvent( )
|
protected
|
|
protected
|
#
popParamsByToken( mixed $token )
|
public
|
#
onPreRender( mixed $param )
Publish the javascript
Parameters
- $param
mixed event parameter
Overrides
|
public
|
#
createChildControls( )
Creates child controls. This method can be overriden for controls who want to
have their controls. Do not call this method directly. Instead, call TControl::ensureChildControls() to ensure child controls are created only once.
Creates child controls. This method can be overriden for controls who want to
have their controls. Do not call this method directly. Instead, call TControl::ensureChildControls() to ensure child controls are created only once.
Overrides
|
public
|
#
onUnload( TEventParameter $param )
Removes localfile on ending of the callback.
Removes localfile on ending of the callback.
Parameters
Overrides
|
public
TBaseActiveCallbackControl
|
#
getActiveControl( )
Returns
Implementation of
|
public
TCallbackClientSide
|
|
public
|
#
addAttributesToRender( THtmlWriter $writer )
Adds ID attribute, and renders the javascript for active component.
Adds ID attribute, and renders the javascript for active component.
Parameters
- $writer
THtmlWriter
the writer used for the rendering purpose
Overrides
|
protected
string
|
#
getClientClassName( )
Returns
string corresponding javascript class name for this control.
|
protected
array
|
#
getClientOptions( )
Gets the client side options for this control.
Gets the client side options for this control.
Returns
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)
|
public
boolean
|
#
saveAs( string $fileName, boolean $deleteTempFile = true )
Saves the uploaded file.
Parameters
- $fileName
string the file name used to save the uploaded file
- $deleteTempFile
boolean whether to delete the temporary file after saving. If true, you will not be able
to save the uploaded file again.
Returns
boolean true if the file saving is successful
Overrides
|
public
TImage
|
#
getSuccessImage( )
Returns
TImage
the image displayed when an upload completes successfully.
|
public
TImage
|
#
getErrorImage( )
Returns
TImage
the image displayed when an upload does not complete successfully.
|
public
TImage
|
#
getBusyImage( )
Returns
TImage
the image displayed when an upload is in progress.
|
Methods inherited from TFileUpload
getDataChanged(),
getErrorCode(),
getFileName(),
getFileSize(),
getFileType(),
getHasFile(),
getIsValid(),
getLocalName(),
getMaxFileSize(),
getTagName(),
getValidationPropertyValue(),
loadPostData(),
setIsValid(),
setMaxFileSize()
|
Methods inherited from TWebControl
clearStyle(),
copyBaseAttributes(),
createStyle(),
getAccessKey(),
getBackColor(),
getBorderColor(),
getBorderStyle(),
getBorderWidth(),
getCssClass(),
getDecorator(),
getDisplay(),
getEnsureId(),
getFont(),
getForeColor(),
getHasStyle(),
getHeight(),
getStyle(),
getTabIndex(),
getToolTip(),
getWidth(),
render(),
renderBeginTag(),
renderContents(),
renderEndTag(),
setAccessKey(),
setBackColor(),
setBorderColor(),
setBorderStyle(),
setBorderWidth(),
setCssClass(),
setDisplay(),
setEnsureId(),
setForeColor(),
setHeight(),
setStyle(),
setTabIndex(),
setToolTip(),
setWidth()
|
Methods inherited from TControl
__get(),
addParsedObject(),
addToPostDataLoader(),
addedControl(),
applyStyleSheetSkin(),
autoBindProperty(),
autoDataBindProperties(),
bindProperty(),
broadcastEvent(),
bubbleEvent(),
clearChildState(),
clearControlState(),
clearNamingContainer(),
clearViewState(),
convertUniqueIdToClientId(),
createControlCollection(),
dataBind(),
dataBindChildren(),
dataBindProperties(),
ensureChildControls(),
findControl(),
findControlsByID(),
findControlsByType(),
focus(),
getAdapter(),
getAllowChildControls(),
getAttribute(),
getAttributes(),
getChildControlsCreated(),
getClientID(),
getControlStage(),
getControlState(),
getControls(),
getCustomData(),
getEnableTheming(),
getEnableViewState(),
getEnabled(),
getHasAdapter(),
getHasAttributes(),
getHasChildInitialized(),
getHasControls(),
getHasInitialized(),
getHasLoaded(),
getHasLoadedPostData(),
getHasPreRendered(),
getID(),
getIsSkinApplied(),
getNamingContainer(),
getPage(),
getParent(),
getRegisteredObject(),
getSkinID(),
getSourceTemplateControl(),
getTemplateControl(),
getUniqueID(),
getViewState(),
getVisible(),
hasAttribute(),
initRecursive(),
isDescendentOf(),
isObjectRegistered(),
loadRecursive(),
loadState(),
loadStateRecursive(),
onDataBinding(),
onLoad(),
preRenderRecursive(),
raiseBubbleEvent(),
registerObject(),
removeAttribute(),
removedControl(),
renderChildren(),
renderControl(),
saveState(),
saveStateRecursive(),
setAdapter(),
setAttribute(),
setChildControlsCreated(),
setControlStage(),
setControlState(),
setCustomData(),
setEnableTheming(),
setEnableViewState(),
setEnabled(),
setID(),
setPage(),
setSkinID(),
setTemplateControl(),
setViewState(),
setVisible(),
trackViewState(),
traverseChildControls(),
unbindProperty(),
unloadRecursive(),
unregisterObject()
|
Methods inherited from TComponent
__call(),
__destruct(),
__isset(),
__set(),
__sleep(),
__unset(),
__wakeup(),
asa(),
attachBehavior(),
attachBehaviors(),
attachClassBehavior(),
attachEventHandler(),
canGetProperty(),
canSetProperty(),
clearBehaviors(),
createdOnTemplate(),
detachBehavior(),
detachBehaviors(),
detachClassBehavior(),
detachEventHandler(),
disableBehavior(),
disableBehaviors(),
enableBehavior(),
enableBehaviors(),
evaluateExpression(),
evaluateStatements(),
fxAttachClassBehavior(),
fxDetachClassBehavior(),
getAutoGlobalListen(),
getBehaviorsEnabled(),
getClassHierarchy(),
getEventHandlers(),
getListeningToGlobalEvents(),
getSubProperty(),
hasEvent(),
hasEventHandler(),
hasProperty(),
isa(),
listen(),
raiseEvent(),
setSubProperty(),
unlisten()
|
Constants summary
string |
SCRIPT_PATH |
'prado/activefileupload' |
|
Constants inherited from TControl
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID
|
|