<fileupload>
A swf-specific class for uploading a single file to a server

JavaScript: lz.fileupload
extends <view> » <node> » lz.Eventable »

A class for uploading a single file using the Flash file upload api. This only works with the swf runtime, that is, with lzr=swf10.

Using this class requires a service to which to upload. A sample upload jsp is provided, which uses the cos.jar library from servlets.com. To use the example, copy cos.jar from servlets.com into $TOMCAT_HOME/common/lib and rename lps/components/incubator/uploader/example/upload.jsp.txt to upload.jsp. On windows, edit upload.jsp to have the upload destination of your choice, ie "C:/", by changing the value of saveDirectory. The destination directory is currently /tmp/uploader, which will work for mac and linux servers. Restart tomcat, so it will see the new jar, then visit http://localhost:8080/legals/lps/components/incubator/uploader/example/test-fileupload.lzx?lzr=swf10

To upload multiple files, see <multiplefileupload>

(The terms of the servlets.com license forbid it from being redistributed with OpenLaszlo.)

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
maxsize expression any 10000 read/write
  Max file size in bytes
msg string String   read/write
  message of feedback to user
uploadenable boolean boolean false read/write
  Enable upload. True to enable uploading, false to disable uploading.

Methods

browse()
fileupload.browse();

cancelHandler()
fileupload.cancelHandler(event:Event);
Parameter Name Type Description
event:Event    

completeHandler()
fileupload.completeHandler(event:Event);
Parameter Name Type Description
event:Event    

getName()
fileupload.getName();

httpStatusHandler()
fileupload.httpStatusHandler(event:HTTPStatusEvent);
Parameter Name Type Description
event:HTTPStatusEvent    

ioErrorHandler()
fileupload.ioErrorHandler(event:IOErrorEvent);
Parameter Name Type Description
event:IOErrorEvent    

onCancel()
fileupload.onCancel();

onComplete()
fileupload.onComplete(fr);
Parameter Name Type Description
fr    

onHTTPError()
fileupload.onHTTPError();

onIOError()
fileupload.onIOError();

onOpen()
fileupload.onOpen();

onProgress()
fileupload.onProgress(fr, bytesLoaded, bytesTotal);
Parameter Name Type Description
fr    
bytesLoaded    
bytesTotal    

onSecurityError()
fileupload.onSecurityError();

onSelect()
fileupload.onSelect(fr);
Parameter Name Type Description
fr    

openHandler()
fileupload.openHandler(event:Event);
Parameter Name Type Description
event:Event    

progressHandler()
fileupload.progressHandler(event:ProgressEvent);
Parameter Name Type Description
event:ProgressEvent    

securityErrorHandler()
fileupload.securityErrorHandler(event:SecurityErrorEvent);
Parameter Name Type Description
event:SecurityErrorEvent    

selectHandler()
fileupload.selectHandler(event:Event);
Parameter Name Type Description
event:Event    

upload()
fileupload.upload(url);
Call to actually upload the file to the server.
Parameter Name Type Description
url   the url of the server to which to upload

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy