TransferFile Method

 Object: SoftArtisans.FileUp
 Syntax: TransferFile ([in] Filename)
 Description: This method transfers (downloads) a file from the web server's hard disk to the browser.

The filename must contain the entire valid path. You can use Server.MapPath to map virtual roots to physical directories. See Example 2 below.

Typically, you would set the content (MIME) type before executing this method.
For Internet Explorer users: IE 4 does not recognize MIME types supplied by the web server. Unfortunately, this does not comply with the HTTP protocol. Instead, IE uses the extension found at the end of the URL to determine the MIME type. So to download to IE 4, you must "fool" it with a bogus extension at the end of your URL. Also, IE ignores the MIME-standard content-disposition header that allows the web developer to pre-set the filename contained the user's Save Dialog box. Perhaps with enough grassroots support, Microsoft will modify their products to process these standard MIME headers. To work around this problem, you could set the URL to:

	http://myserver/mydownload.asp?bogus=filename.ext
or
	http://myserver/mydocgenerator.asp?bogus=file.doc
We recommend that you either upgrade to IE 5, which solves the problem, or use SA-XFile for downloading.

Example 1:

	<%
	Response.ContentType = "application/msword"

	'---
	'--- Create an instance of the file download component.
	'---
	Set Download = Server.CreateObject("SoftArtisans.FileUp")
	'---
	'--- Do the transfer. There is only one parameter: the local webserver
	'--- filename. It can be any valid filename (UNICODE ok), as long as
	'--- the IUSR_<machinename> account has read access. 
	'---
	Download.TransferFile "c:\myserverdir\sample.doc"

	... %>

Example 2:

	<% download.TransferFile server.mappath("sample.doc") %>

 

Previous Page Next Page