Automating An 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.

Using SoftArtisans XFile you can completely automate the upload.

Note: When a component is signed by SoftArtisans, there will always be a final conformation displayed to the user when automatically uploading. We provide XFile 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.

SoftArtisans, Inc. disavows all responsibility of XFileused 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.

Top


Automating An Upload with XFile

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, XFiledisplays 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" id="AXFFile"
style="height: 200px; left: 0px; top: 0px; width: 400px"
codebase="/saxfilesamples/saxfile.cab" viewastext>
</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="XFRequest">
....

You can set properties through subroutines:

....
<script language="vbscript">

Sub UploadButton_OnClick()

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

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

'-- Start the transfer
XFRequest.Start
End Sub

</script>
....

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

Top

Copyright © 2010 SoftArtisans, Inc. All rights reserved.