 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Perry Way Guest
|
Posted: Thu Feb 05, 2004 11:22 pm Post subject: POST, serving files dynamically, missing file name in "Save |
|
|
I'm scratchin' my head here...
I'm serving files dynamically in ISAPI .dll.
I use POST method.. ONLY. It HAS to be this way.
When server responds by serving file, the "Save File" dialog shows a file
name of "file".
Gee... that's really... helpful. <g> The user must type type type..
every time.. I know the name of the file.. the web client *can* know the
name of the file because I'm displaying the name on the web page they use to
click on button to download.
Is there a way to somehow stick a file name in the Save dialog? I realize
maybe this is a client-side issue only.... Perhaps I should use some
Javascript technique to fool IE into sticking the name of the file in the
Save dialog?
any helpful hints? anyone?
Thanks!
Perry
|
|
| Back to top |
|
 |
Perry Way Guest
|
Posted: Thu Feb 05, 2004 11:54 pm Post subject: Re: POST, serving files dynamically, missing file name in "S |
|
|
Nevermind!!!!!!!!
I found the cure... and I came back here to post it in case any readers are
curious how this is done..
You must set the custom header of the response to:
name: 'Content-Disposition'
value: 'attachment, filename=<provide filename here>'
Code snippet example following....
ms := TMemoryStream.Create;
try
ms.LoadFromFile(sPath);
Response.ContentType := 'application/download';
Response.ContentStream := ms;
Response.SetCustomHeader('Content-Disposition', 'attachment;
filename=' + ExtractFileName(sPath));
Response.SendResponse;
Handled := True;
Exit;
except
// only gets here if file cannot be loaded because //
// ShareDenyRead was set by some other process //
// opening the same file //
ms.Free;
end;
"Perry Way" <no.delphipro.spam (AT) no (DOT) spam.earthlink.net> wrote
| Quote: | I'm scratchin' my head here...
I'm serving files dynamically in ISAPI .dll.
I use POST method.. ONLY. It HAS to be this way.
When server responds by serving file, the "Save File" dialog shows a file
name of "file".
Gee... that's really... helpful. <g> The user must type type type..
every time.. I know the name of the file.. the web client *can* know the
name of the file because I'm displaying the name on the web page they use
to
click on button to download.
Is there a way to somehow stick a file name in the Save dialog? I realize
maybe this is a client-side issue only.... Perhaps I should use some
Javascript technique to fool IE into sticking the name of the file in the
Save dialog?
any helpful hints? anyone?
Thanks!
Perry
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|