This script demonstrates getting properties of a file, such as name and size, and using a response stream to send the file to the users browser.
GET THE SOURCE
SEE IT IN ACTION
The script begins by calling the function "downloadFile" with the file we wish to download as a parameter, in this case getting it from the "file" request variable.
DownloadFile() first gets full path of specified file and checks to see if the file exists using the FileExists(strFilename) method of the filesystem object. It then gets the length of the file (the size) using the .size property of the file object.
Lines 19 and 20 show how we create the stream object and in line 23 we set the stream to binary. Line 42 uses the loadfromfile method to begin the process to read in the file, and after the headers have been set between lines 49 and 52, the file is output using Response.Binarywrite and the contents of the streams "read".
I have fudged this script a bit by using a default content type of "octet", you could improve this scripts functionality by specifying the corrent mime type.