| The previous lessons demonstrated manipulating JFile's upload and download applets using HTML
<param> tags. You can also control JFile in JavaScript. JFile's numerous JavaScript methods
are defined in the UploadClient Applet and
DownloadClient Applet sections of the Programmer's Reference. The following exercise hides JFile's ready-made file list and transfer status windows. This allows you to create your own user interface. We will create a very simple interface: an upload button. When clicked, the button will call JFile's startUpload method.
|
|
<APPLET codebase="/JFileScripts" code="softartisans.filetransfer.UploadClient.class" height="0" width="0" mayscript archive="filetransfer.jar" name="fileupload"> <!-- The Cabbase parameter specifies the cab file containing the applet. --> <PARAM name="cabbase" value="filetransfer.cab"> <!-- The PostURL parameter specifies the URL to which the file will be posted. --> <PARAM name="PostURL" value="http://localhost/jfilescripts/formresp.asp"> <!-- The FileName# parameter specifies a file to transfer. When uploading more than one file, use "FileName1," "FileName2," etc. --> <PARAM name="Filename1" value="c:\boot.ini"> <!-- The HideFileList and HideTransferStatus parameters hide JFile's file list and transfer status windows, allowing the programmer to control the user interface. --> <PARAM name="HideFileList" value="1"> <PARAM name="HideTransferStatus" value="1"> </APPLET> <!-- Create a button that calls JFile's startUpload method. --> <input type="button" value="Upload c:\boot.ini" onclick="document.fileupload.startUpload();">
<PARAM name="UseAppletInBrowser" value=1>If you do not set UseAppletInBrowser to 1, that is, if you display the applet in a separate window, set Height and Width to 0.
| JavaScript methods are case-sensitive. |
| Previous Page | Next Page |