[thelist] EPS Files
Wade Armstrong
wade_lists at runstrong.com
Thu Dec 19 11:37:01 CST 2002
on 12/19/02 8:22 AM, Martyn Haigh at martyn.haigh at virgincosmetics.com wrote:
> Could you give me an example of specifying the content-type (I'm using ASP),
> as this is all new ground for me!
I use this code for downloading files in asp. Save this file as
download.asp, and specify a file to download by pointing your browser to
download.asp?file=filename
<% @LANGUAGE = VBSCRIPT %>
<% Option Explicit %>
<%
Dim strFile, strPath
strFile = Request.QueryString("file")
strPath = "/download/" & strFile 'or whatever your path/to/file is
strPath = Server.MapPath(strPath)
Response.AddHeader "content-disposition","attachment; filename=" & strFile
'The below sets the file to download only (except for images in mac ie 5+).
'Set to whatever content type you like
Response.ContentType = "application/octet-stream"
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1 'adTypeBinary
objStream.Open
objStream.LoadFromFile(strPath)
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Response.End
%>
More information about the thelist
mailing list