• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 217
  • Last Modified:

Returning a File from a TWebAction (revisited)

I have a WebBroker App that returns a file thru a TWebAction. It does so by pointing to the following link:

http://ServerName/ISAPI_AppName/WebActionName?File=FileName

The program then generates the file from a DB field and returns it. The problem is that, when the Save to Disk windos appears it shows the file to save as "WebActionName" instead of "FileName".

How can I make the file to be returned with the right name?

Code:

    Response.ContentStream := SomeStreamWithTheFileInside;
    Response.ContentType := 'application/octet-stream';
    Response.SendResponse;
0
undergroundo
Asked:
undergroundo
1 Solution
 
BlackTigerXCommented:
try
    Response.ContentStream := SomeStreamWithTheFileInside;
    Response.ContentType := 'application/octet-stream';

    Response.SetCustomHeader('Content-Disposition', 'attachment; Filename=' +FileNameVar);

    Response.SendResponse;
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now