forcing files to download problem
I am using the following code to force a file to download. The code works correctly if the file is less than about 4.5mb. It will not work if the file size is greater than that. Could the script be timing out or do servers have a limitation as to how big the file you can stream is?
strFileName = "SomeSongFile.mp3"
strFilePath = "C:fullpath\" & strFileName
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strFilePath) Then
Set mp3File = objFSO.GetFile(strFilePath)
strFileSize = mp3File.Size
Set objFSO = Nothing
Set mp3File = Nothing
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.AddHeader "Content-Length", strFileSize
Response.Charset = "UTF-8"
Response.ContentType = "application/x-unknown"
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
End If
Thank You
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
|