File Download dialog box

S

shank

http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html

I have the below code borrowed from above to open a "save as.." filedownload
dialog box.
The dialog box will open and prompt me to save the right filename. Great!
Problem: the file is saved at 0 bytes. No content! No errors!

<%
Response.ContentType = "application/x-unknown" ' arbitrary
fn = (rsFileDownload.Fields.Item("FileNam").Value)
FPath = "http://www.mydomain.com" &
(rsFileDownload.Fields.Item("Folder").Value) & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing

Response.End
%>

So, to troubleshoot, I wrote these out...

<%=fn%><br>
<%=FPath%><br>

....then cut-n-pasted the full link in my browser address bar.
And everything downloaded fine.
So, the link is good.
What's going wrong here?

thanks
 
S

shank

OK... I think I figured it out.
1) I had to use local link: c:\inetpub\... (then it only worked part of the
time)
2) I used the code shown at the bottom of aspfaq link below. Seem to be
working now.
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top