|Subject:||Re: How to specify the name of a downloaded file (IdHttpServer)|
|Posted by:||Remy Lebeau (TeamB) (email@example.com)|
|Date:||Mon, 23 Jul 2007|
"Thomas Bergerot" <firstname.lastname@example.org> wrote in message
> Using a TIdHttpServer, i use OnCommandGet(), and send
> a file using ServeFile().
You did not say which version of Indy you are using.
> The problem is the requested url is http://localhost/pimpmyfile,
> and the file is automatically named "pimpmyfile" by firefox.
That is because there is no filename being provided in the response headers,
so the browser (any browser, not just FireFox) will use the filename from
the original URL.
> How can i tell firefox the new name of my dowloaded file ?
You need to set the "Content-Disposition" response header before calling
Format('attachment; filename="%s"', [TheFileNameHere]);
> I tried AResponseInfo.Location, without success.
That property has nothing to do with this issue.
How to specify the name of a downloaded file (IdHttpServer) posted by Thomas Bergerot on Sun, 22 Jul 2007