IComponent for uploading files from client to server.
The visible component consists of a file name input box and a browse
button and an upload submit button to start uploading.
The Upload component needs a StringIO to write the uploaded data. You
need to implement the upload.IReceiver interface and return the output
stream in the receiveUpload() method.
You can get an event regarding starting (StartedEvent), progress
(ProgressEvent), and finishing (FinishedEvent) of upload by implementing
IStartedListener, IProgressListener, and IFinishedListener, respectively.
The IFinishedListener is called for both failed and succeeded uploads. If
you wish to separate between these two cases, you can use
ISucceededListener (SucceededEvenet) and IFailedListener
(FailedEvent).
The upload component does not itself show upload progress, but you can
use the ProgressIndicator for providing progress feedback by implementing
IProgressListener and updating the indicator in updateProgress().
Setting upload component immediate initiates the upload as soon as a
file is selected, instead of the common pattern of file selection field
and upload button.
Note! Because of browser dependent implementations of <input
type="file"> element, setting size for Upload component is
not supported. For some browsers setting size may work to some
extent.
|
__init__(self,
caption=None,
uploadReceiver=None)
Creates a new instance of Upload. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fireStarted(self,
filename,
MIMEType)
Emit upload received event. |
source code
|
|
|
fireUploadInterrupted(self,
filename,
MIMEType,
length,
e=None)
Emits the upload failed event. |
source code
|
|
|
fireNoInputStream(self,
filename,
MIMEType,
length) |
source code
|
|
|
fireNoOutputStream(self,
filename,
MIMEType,
length) |
source code
|
|
|
fireUploadSuccess(self,
filename,
MIMEType,
length)
Emits the upload success event. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setButtonCaption(self,
buttonCaption)
In addition to the actual file chooser, upload components have button
that starts actual upload progress. |
source code
|
|
|
|
|
|
|
|
|
getListeners(self,
eventType)
Returns all listeners that are registered for the given event type or
one of its subclasses. |
source code
|
|
|
|
Inherited from abstract_component.AbstractComponent :
__getstate__ ,
__setstate__ ,
addStyleName ,
attach ,
childRequestedRepaint ,
detach ,
fireComponentErrorEvent ,
fireComponentEvent ,
fireEvent ,
fireRequestRepaintEvent ,
getApplication ,
getCSSHeight ,
getCSSWidth ,
getCaption ,
getComponentError ,
getData ,
getDebugId ,
getDescription ,
getErrorHandler ,
getErrorMessage ,
getHeight ,
getHeightUnits ,
getIcon ,
getLocale ,
getParent ,
getStyle ,
getStyleName ,
getWidth ,
getWidthUnits ,
getWindow ,
handleError ,
hasListeners ,
isEnabled ,
isImmediate ,
isReadOnly ,
isVisible ,
paint ,
parseStringSize ,
registerCallback ,
registerListener ,
removeStyleName ,
requestRepaintRequests ,
setCaption ,
setComponentError ,
setData ,
setDebugId ,
setDescription ,
setEnabled ,
setErrorHandler ,
setHeight ,
setHeightUnits ,
setIcon ,
setImmediate ,
setLocale ,
setParent ,
setReadOnly ,
setSizeFull ,
setSizeUndefined ,
setStyle ,
setStyleName ,
setVisible ,
setWidth ,
setWidthUnits ,
withdrawCallback ,
withdrawListener
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|