?
Solved

Returning a File from a TWebAction (revisited)

Posted on 2005-03-02
1
Medium Priority
?
208 Views
Last Modified: 2010-04-05
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
Comment
Question by:undergroundo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 2000 total points
ID: 13445229
try
    Response.ContentStream := SomeStreamWithTheFileInside;
    Response.ContentType := 'application/octet-stream';

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

    Response.SendResponse;
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question