Name

fileupload — A swf8-specific class for uploading a single file to a server

Synopsis

LZX: fileupload
JavaScript: lz.fileupload
Type: Class
Access: public
Topic: Incubator.Components
Declared in: lps/components/incubator/uploader/fileupload.lzx

Description

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

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=swf8

To upload multiple files, see multiplefileupload

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

Superclass Chain

node (LzNode) » view (LzView) » fileupload

Known Subclasses

Details

Properties (4)

fileref
<attribute name="fileref" value="$once{new flash.net.FileReference()}" />
private var fileref;
file reference, for internal use
maxsize
<attribute name="maxsize" value="10000" />
public var maxsize;
Max file size in bytes
msg
<attribute name="msg" type="string" value="" />
public var msg : String;
message of feedback to user
uploadenable
<attribute name="uploadenable" type="boolean" value="false" />
public var uploadenable : boolean;
Enable upload. True to enable uploading, false to disable uploading.

Methods (10)

browse()
<method name="browse" />
public function browse();
getName()
<method name="getName" />
public function getName();
onCancel()
<method name="onCancel" />
public function onCancel();
onComplete()
<method name="onComplete" />
public function onComplete();
onHTTPError()
<method name="onHTTPError" />
public function onHTTPError();
onIOError()
<method name="onIOError" />
public function onIOError();
onOpen()
<method name="onOpen" />
public function onOpen();
onProgress()
<method name="onProgress" />
public function onProgress();
onSecurityError()
<method name="onSecurityError" />
public function onSecurityError();
upload()
<method name="upload" args="url" />
public function upload(url);
Call to actually upload the file to the server.

LZX Synopsis

<class name="lz.fileupload" extends=" LzView ">
  <attribute name=" fileref " value="$once{new flash.net.FileReference()}" />
  <attribute name=" maxsize " value="10000" />
  <attribute name=" msg " type="string" value="" />
  <attribute name=" uploadenable " type="boolean" value="false" />
  <method name=" browse " />
  <method name=" getName " />
  <method name=" onCancel " />
  <method name=" onComplete " />
  <method name=" onHTTPError " />
  <method name=" onIOError " />
  <method name=" onOpen " />
  <method name=" onProgress " />
  <method name=" onSecurityError " />
  <method name=" upload " args="url" />
</class>

JavaScript Synopsis

public lz.fileupload extends  LzView  {
  private var fileref ;
  public var maxsize ;
  public var msg  : String;
  public var uploadenable  : boolean;
  prototype public function browse ();
  prototype public function getName ();
  prototype public function onCancel ();
  prototype public function onComplete ();
  prototype public function onHTTPError ();
  prototype public function onIOError ();
  prototype public function onOpen ();
  prototype public function onProgress ();
  prototype public function onSecurityError ();
  prototype public function upload (url);
}