Class RapidContext.Widget.FileStreamer

Extends: RapidContext.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.

Source code: RapidContext_Widget_FileStreamer.js

Class Summary
 
Creates a new file streamer widget.
Method Summary
 
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Methods borrowed from class RapidContext.Widget:
addAll, addChildNode, addClass, animate, blurAll, destroy, disable, enable, getChildNodes, hasClass, hide, isDisabled, isHidden, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass, uid
Event Summary
 
Emitted when the file upload begins.
 
Emitted when the file upload has completed.
Class Detail
RapidContext.Widget.FileStreamer(attrs)
Creates a new file streamer widget.
JavaScript:
var file = RapidContext.Widget.FileStreamer({ url: "rapidcontext/upload/my_id" });
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
{Boolean} attrs.hidden Optional
the hidden widget flag, defaults to false
Returns:
{Widget} the widget DOM node
Method Detail
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
{Boolean} attrs.hidden Optional
the hidden widget flag
Event Detail
onselect()
Emitted when the file upload begins. This event is triggered by the user selecting a file to upload, which automatically starts the upload. This event signal carries no event information.

onupload()
Emitted when the file upload has completed. This event signal carries no event information.