Automating Upload

There may be times when you do not want any user intervention to upload files. For example, if you upload the same files everyday, you may not need to see or select the filenames.

The two client-side components, SA-XFile and SA-JFile, provide means by which you can completely automate the upload.

When component is signed by Software Artisans: There will always be a final conformation displayed to the user when automatically uploading. We provide SA-XFile and SA-JFile in an unsigned format so that you can apply your own digital signature.

When you sign the component, there will not be any confirmation of the upload by the user. You will have the ability to disable any prompt or display of the upload.

Software Artisans, Inc. disavows all responsibility of SA-JFile or SA-XFile used in malicious ways to take files from a user's hard disk or to place files on a user's hard disk without their consent. By signing the control with your signature, you assume full responsibility that the control is used in an appropriate manner that respects the user's privacy and integrity.

In SA-JFile

When you use SA-JFile, an applet window usually displays a file selection dialog box. If you do not want to display the dialog box, you can use the HideFileList and HideTransferStatus properties:

<APPLET CODEBASE="/SAJFileSamples" code="softartisans.filetransfer.DownloadClient.class" height="0" width="0" mayscript archive="filetransfer.jar" name="filedownload">
	<PARAM name="cabbase" value="filetransfer.cab">
	<PARAM name="HideFileList" value="1">
	<PARAM name="HideTransferStatus" value="1">
	<PARAM name="FinalURL" value="http://<HostName>/sajfilesamples/download/confirm.asp">
	<PARAM name="FileName1" value="c:\temp\sample.doc">
	<PARAM name="URL1" value="http://<HostName>/sajfilesamples/download/sample.doc">
</APPLET>

In SA-XFile

SA-XFile does not need or have parameters to hide the control, since it depends on whether you are using the non-visual or visual object, which is determined by the Classid attribute of the <OBJECT> tag.

If you are using the visual object, SA-XFile displays a file list in an ActiveX Control window that supports drag and drop. The following code is an example of using a visual object:

....
<OBJECT classid=CLSID:230C3D02-DA27-11D2-8612-00A0C93EEA3C height=200 id=AXFFile 
style="HEIGHT: 200px; LEFT: 0px; TOP: 0px; WIDTH: 400px" width=400 VIEWASTEXT codebase="/saxfilesamples/saxfile.cab">
<PARAM NAME="_cx" VALUE="10583">
<PARAM NAME="_cy" VALUE="5292">
<PARAM NAME="Appearance" VALUE="0">
<PARAM NAME="BackColor" VALUE="16777215">
<PARAM NAME="BackStyle" VALUE="0">
<PARAM NAME="BorderColor" VALUE="3452816845">
<PARAM NAME="BorderStyle" VALUE="0">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="ForeColor" VALUE="0">
<PARAM NAME="TabStop" VALUE="-1">
</OBJECT>
....

For a non-visual object, the code looks like the following:

....
<OBJECT CLASSID="clsid:C3A57B60-C117-11D2-BD9B-00105A0A7E89" codebase="/saxfilesamples/saxfile.cab" ID="SAXFile">
....

You can set properties through subroutines:

....
<SCRIPT LANGUAGE="VBS">

Sub UploadButton_onClick()

	'-- Set the URL where we want to send the data by
	'-- using the CurrentURL property
    SAXFile.CurrentURL = "http://localhost/SAXFileSamples/asp/post/onefile/formresp.asp"

	' -- add the file to the upload	
    SAXFile.AddFile "C:\boot.ini", "FileName1"

	' -- start the transfer
	SAXFile.Start
end Sub

</Script>
....

For more examples, check out the samples provided as part of the SA-FileUp distribution. See Programmer's Samples for a list of the contents of the Samples directory.

 

 

Previous Page Next Page