In the following exercise, we will script a simple, single-file upload. We will use the HTML
<APPLET> tag to call JFile's
UploadClient
applet from an HTML script. The exercise posts the upload to a server-side ASP (Active Server Pages) script that uses SoftArtisans FileUp to process the upload. We will preset a single file - boot.ini - to upload. JFile allows the user to select additional files, delete files, enter a directory to upload, or delete a directory from the upload list.
|
|
<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">
</APPLET>
http://localhost/jfilescripts/upload.htm
.APPLET
tag adds JFile's UploadClient applet to your web page. We assigned values to several APPLET
attributes:Codebase
Codebase
is optional. When the Java class is in a different
directory, specify the complete relative path or URL.Code
Height
and Width
UseAppletInBrowser
to 1, as follows.
<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.Mayscript
Archive
Name
Name
. Use the
name you assign to reference the UploadClient applet in script.Cabbase
parameter specifies the cab file containing the Java applet. Filetransfer.cab contains JFile's Java
class files for Microsoft VM.PostURL
parameter specifies the URL to which the file will be posted, http://localhost/jfilescripts/formresp.asp.
Formresp.asp uses SoftArtisans FileUp to process the upload.FileNameN
parameter specifies a file to transfer. When uploading more than one file, use
"FileName1," "FileName2," etc.Copyright © 2000-2003 SoftArtisans, Inc. All rights reserved.