Class Index | File Index

Classes


Class MochiKit.Widget.FileStreamer


Extends MochiKit.Widget.
The file streamer widget class. This widget is used to provide a file upload (file input) control that can stream the selected file to the server. The file data is always sent asynchronously (i.e. in the background) to allow the rest of the web page to remain active also during the potentially long delays caused by sending large amounts of data. The widget creates its own IFRAME HTML element inside which the actual FORM and INPUT elements are created automatically. In addition to standard HTML events, the "onselect" and "onupload" events are also triggered.
Defined in: Widget.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new file streamer widget.
Fields borrowed from class MochiKit.Widget:
_id, Classes
Method Summary
Method Attributes Method Name and Description
 
Handles the file input onchange event.
 
Handles the iframe onload event.
 
Creates the document form and file input element.
 
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Methods borrowed from class MochiKit.Widget:
_animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addChildNode, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, getChildNodes, hasClass, hide, isFormField, isHidden, isWidget, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass
Class Detail
MochiKit.Widget.FileStreamer(attrs)
Creates a new file streamer widget.
var file = MochiKit.Widget.FileStreamer({ url: "rapidcontext/upload/myid" });
form.addAll(file);
MochiKit.Signal.connect(file, "onselect", function () {
    file.hide();
    // add code to show progress bar
});
Parameters:
{Object} attrs
the widget and node attributes
{String} attrs.url Optional
the URL to post the data to, defaults to window.location.href
{String} attrs.name Optional
the file input field name, defaults to 'file'
{String} attrs.size Optional
the file input size, defaults to '30'
Returns:
{Widget} the widget DOM node
Method Detail
_handleChange()
Handles the file input onchange event.

_handleLoad()
Handles the iframe onload event.

_initDocument()
Creates the document form and file input element.

setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Parameters:
{Object} attrs
the widget and node attributes to set
{String} attrs.url Optional
the URL to post the data to
{String} attrs.name Optional
the file input field name
{String} attrs.size Optional
the file input size

Documentation generated by JsDoc Toolkit 2.0.2 on Sun May 24 2009 13:14:16 GMT+0200 (CEST)