Class: FileToStreamUploader

Source Location: /class/fileHandling.php.inc

Class Overview

Node
   |
   --FileToStreamUploader

Background file-to-stream uploader

This class creates an object that uploads a file from the client to a stream on the server. Construct it with a source (client) path and a stream resource. Then call the method startUpload(). This control fires the event 'finished' when the upload was successful, 'failed' when it went wrong or 'cancelled' when the upload was cancelled through the cancelUpload() method. It also fires the event 'cycle' for every chunk received, allowing you to keep track of progress.



see:  XULFilePicker


Author(s):

Variables

Methods

Inherited Variables

Class: Node

Node::$behavior
Node::$eventHandler
Node::$eventType
Node::$eventYielder
Node::$handlerFor
Node::$id
Node::$isChild
Node::$isRegistered
Node::$observerTopics
Node::$parent
Node::$rootApplication
Node::$rootWindow
Node::$yielderFor

Inherited Methods

Class: Node

Node::__construct()
Dynamic Constructor
Node::accessKey()
Set the accessKey attribute for this element
Node::addBehavior()
Add a behavior class
Node::addObserver()
Add an observer to this Node
Node::align()
Set the align attribute for this element
Node::attach()
[INTERNAL FUNCTION] Default attach method
Node::attributeMethod()
Convenient attribute setter
Node::backgroundColor()
Set the background color for the element
Node::backgroundImage()
Set the background of a node using CSS background-image property
Node::BehaviorCreateClass()
Constructs a Behavior class from a string classname and a settings array.
Node::BehaviorSetClassSettings()
Automatically initializes Behavior object
Node::blur()
Make this node loose focus
Node::callMethod()
Call a JavaScript method on the client-side node
Node::callMethodDelayed()
Call a JavaScript method on the client-side node in a delayed fashion
Node::className()
Set the CSS classname for the element
Node::commandHandler()
[INTERNAL FUNCTION] Handles an incoming event for this node
Node::context()
Set a contextmenu to show when clicking the context (right) mouse or keyboard button on this element
Node::createClientEvent()
Creates a new event on the client side
Node::createRemoteObject()
[INTERNAL FUNCTION] Calls the remote constructor of this class
Node::crop()
Set the crop attribute for this element
Node::detach()
[INTERNAL FUNCTION] Default detach method
Node::disableBehavior()
Disable behavior
Node::disabled()
Set the disabled attribute for this element
Node::enableBehavior()
Enable behavior
Node::equalsize()
Set the equalsize attribute for this element
Node::extractNode()
Extracts this node and its childnodes
Node::findAncestor()
Return the first ancestor of a certain class of this node
Node::fireClientEvent()
Fires a remote (client) event
Node::fireLocalEvent()
Fires a local (server) event
Node::flex()
Set the flex attribute for this element
Node::focus()
Give this node focus
Node::getBehavior()
Get a behavior class.
Node::height()
Set the height of the element
Node::hidden()
Set the hidden attribute for this element
Node::initNodeLayout()
[INTERNAL FUNCTION] Initializes the attributes of a node when it is registered
Node::insertElement()
[INTERNAL FUNCTION] Inserts the newly constructed node's element into the DOM tree on the client side
Node::label()
Set the label attribute for this element
Node::margin()
Set the margin of the element
Node::marginBottom()
Set the bottom margin of the element
Node::marginLeft()
Set the left margin of the element
Node::marginRight()
Set the right margin of the element
Node::marginTop()
Set the top margin of the element
Node::mousethrough()
Indicate whether mouse events should pass through this node onto its parent
Node::orient()
Set the orient attribute for this element
Node::pack()
Set the pack attribute for this element
Node::padding()
Set the padding of the element
Node::paddingBottom()
Set the bottom padding of the element
Node::paddingLeft()
Set the left padding of the element
Node::paddingRight()
Set the right padding of the element
Node::paddingTop()
Set the top padding of the element
Node::popup()
Set a popup menu to show when clicking on this element
Node::removeAttribute()
Remove an attribute on the client-side XUL node
Node::removeBehavior()
Delete behavior
Node::removeElement()
[INTERNAL FUNCTION] Removes the node's element from the client DOM tree
Node::removeEventHandler()
Removes an event handler
Node::removeEventReflex()
Removes a previously set reflex for a certain event
Node::removeEventYielder()
Removed a node this is yielded when an event on this node fires
Node::removeNode()
Removes and unregisters this node and its childnodes
Node::removeObserver()
Remove an observer from this Node
Node::removeObservers()
Remove all observers from this Node
Node::setAttribute()
Set an attribute on the client-side XUL node
Node::setDraggable()
Set this element as draggable
Node::setDroppable()
Set this element as a dropzone
Node::setEvent()
Shorthand version for setEventType, setEventHandler and setEventYielder
Node::setEventBlocking()
Sets whether the event should block (be synchronous)
Node::setEventHandler()
Sets an event handler
Node::setEventReflex()
Sets a reflex for a certain event
Node::setEventType()
Sets the event type for a certain event
Node::setEventYielder()
Sets a node to yield when an event on this node fires
Node::setMethod()
Set a JavaScript method on the client-side node
Node::setProperty()
Set a JavaScript property on the client-side node
Node::setStyle()
Set a CSS style property on the client-side XUL node
Node::size()
Set the size of the element
Node::textColor()
Set the text color for the element
Node::textSize()
Set the text size for the element
Node::textStyle()
Set the text style for the element
Node::tooltip()
Set a tooltip to show when hovering over this element
Node::tooltiptext()
Set the tooltiptext attribute for this element
Node::unbind()
[INTERNAL FUNCTION] Removes links to child and parent nodes
Node::unlink()
[INTERNAL FUNCTION] Removes event handler and yielder links to other nodes
Node::unRegister()
[INTERNAL FUNCTION] Removes this node from the client registry
Node::value()
Set the value attribute for this element
Node::width()
Set the width of the element
Node::yield()
Manually yield this node
Node::_dropHandler()
Node::__call()
PHP Magic function: Behavior pattern handler.

Class Variables

$clientPath =

access:  public
Type:   mixed

$fileSize =  NULL

access:  public
Type:   mixed

$remoteConstructor =  'FileUploader'

access:  public
Type:   mixed

$stream =  NULL

access:  public
Type:   mixed



Class Methods


constructor __construct() [line 427]

FileToStreamUploader __construct( [string $clientPath = NULL], [resource $stream = NULL])

Constructor

access:  public

Overrides Node::__construct() (Dynamic Constructor)

Parameters:

string   $clientPath   Source file path on the client side
resource   $stream   Stream to write data to

[ Top ]

method attach() [line 434]

void attach( )

access:  public

Overrides Node::attach() ([INTERNAL FUNCTION] Default attach method)

[ Top ]

method cancelUpload() [line 493]

void cancelUpload( )

Cancel a running upload

Cancels the uploader which fires the 'cancelled' event


access:  public

[ Top ]

method detach() [line 443]

void detach( )

access:  public

Overrides Node::detach() ([INTERNAL FUNCTION] Default detach method)

[ Top ]

method handleError() [line 502]

void handleError( $e, $remotePath)

Event handler for the 'failed' and 'cancelled' events

access:  public

Parameters:

   $e  
   $remotePath  

[ Top ]

method handleFileChunk() [line 511]

void handleFileChunk( $e, $filesize, $progress, $cycle, $data)

Event handler for the 'cycle' event

access:  public

Parameters:

   $e  
   $filesize  
   $progress  
   $cycle  
   $data  

[ Top ]

method setSourcePath() [line 454]

void setSourcePath( string $clientPath)

Set the source path

access:  public

Parameters:

string   $clientPath   Source file path on the client side

[ Top ]

method setStream() [line 465]

void setStream( resource $stream)

Set the stream to write to

access:  public

Parameters:

resource   $stream   Stream to write data to

[ Top ]

method startUpload() [line 479]

void startUpload( )

Start the upload

Starts the uploader which fires the 'started' event beforehand


access:  public

[ Top ]


Documentation generated on Mon, 07 Apr 2014 00:51:19 +0200 by phpDocumentor 1.4.3