Link to home
Start Free TrialLog in
Avatar of moonrise
moonrise

asked on

How to trigger a download of a file

I have a ISAPI program which retrieves data from a database and writes the data into a file with Comma Separated Value format. When the user triggers the execution of this ISAPI Dll, I want the user to get the file download dialog. What do I need to send instead of the existing code:

      StrPCopy(vBuffer, 'Content-Type: text/html' + CrLf +  CrLf +
                   '<HTML>' + CrLf + '<HEAD>' + CrLF + '<TITLE>Report</TITLE>' + CrLf +
                   '</HEAD>' + CrLf + '<BODY BGCOLOR="#FFFFFF" TEXT="#000000" BACKGROUND="yellowbk.gif"><DIV ALIGN="CENTER"><CENTER>' + CrLf + CrLf );

I suspect I need to change the Content-Type, etc...

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of moonrise
moonrise

ASKER

Content-Type: application/octet-stream  works - how do I specify the default file name to be used, let say report.csv?
Content-Type: application/octet-stream; name=report.csv
instead of using the file name I specify it uses the name of the DLL (ISAPI) - report.dll, any idea why?
Hmmm.  Got me stumped there.