D
Dan Sikorsky
How do I force the "Save As" dialog box so the client can save the file into
the folder of their choice?
The following code should work, according to Microsoft, but downloads the
file into the body of the browser window:
<%
Dim Stream
Dim Contents
Dim FileName
Dim FileExt
Const adTypeBinary = 1
FileName = Request.QueryString("fn")
if FileName = "" Then
Response.Write "Filename Not specified."
Response.End
End if
' Make sure they are not requesting your
' code
FileExt = Mid(FileName, InStrRev(FileName, ".") + 1)
Select Case UCase(FileExt)
Case "ASP", "ASA", "ASPX", "ASAX", "MDB"
Response.Write "Protected file Not allowed."
Response.End
End Select
' Download the file
Response.Clear
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" & FileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Type = adTypeBinary
Stream.Open
Stream.LoadFromFile Server.MapPath("uploaded") & "\" & FileName
While Not Stream.EOS
Response.BinaryWrite Stream.Read(1024 * 64)
Wend
Stream.Close
Set Stream = Nothing
Response.Flush
Response.End
%>
the folder of their choice?
The following code should work, according to Microsoft, but downloads the
file into the body of the browser window:
<%
Dim Stream
Dim Contents
Dim FileName
Dim FileExt
Const adTypeBinary = 1
FileName = Request.QueryString("fn")
if FileName = "" Then
Response.Write "Filename Not specified."
Response.End
End if
' Make sure they are not requesting your
' code
FileExt = Mid(FileName, InStrRev(FileName, ".") + 1)
Select Case UCase(FileExt)
Case "ASP", "ASA", "ASPX", "ASAX", "MDB"
Response.Write "Protected file Not allowed."
Response.End
End Select
' Download the file
Response.Clear
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" & FileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Type = adTypeBinary
Stream.Open
Stream.LoadFromFile Server.MapPath("uploaded") & "\" & FileName
While Not Stream.EOS
Response.BinaryWrite Stream.Read(1024 * 64)
Wend
Stream.Close
Set Stream = Nothing
Response.Flush
Response.End
%>