| JFile allows the user to upload one or more individual files, or a whole directory.
JFile's addDirectory method adds the contents of a directory, excluding sub-directories, to the
upload. addDirectoryRecursive uploads a directory with its subdirectories, maintaining the original directory
structure. When uploading a directory, use SoftArtisans FileUp's
SaveRecursive method in your response script, as demonstrated in Exercise 4. To upload a directory recursively, check Recursive. Using the system's native file selection dialog, you cannot browse to a folder and click "Open" to add it to the file/folder list. Instead, enter the directory path and name in the File/Dir input field. To allow the user to browse to a folder and select it, set JFile's UseNativeFileSelection parameter to 0. When UseNativeFileSelection is disabled, JFile will display a platform-neutral file selection dialog box when the user clicks Add Files/Directory.
|
|
<!-- The script's onload event calls the function myTransferProgress(), defined below. -->
<BODY language="javascript" onload="myTransferProgress()">
<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/RecursJFileResp.asp">
</APPLET>
<SCRIPT language="Javascript">
// JFile will set the variable SAJFileAppletLoaded to True when the applet is loaded.
var SAJFileAppletLoaded = False;
// The function myTransferProgress() adds a directory to the applet's upload list.
function myTransferProgress()
{
if(SAJFileAppletLoaded)
{
// addDirectoryRecursive adds the specified directory to the list of files and folders to
// upload. Enter a valid directory and path.
document.fileupload.addDirectoryRecursive("X:\\FolderName\\SubFolderName")
}
else
alert("Applet is not loaded.");
}
</SCRIPT>
</BODY><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 |