BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

POST, serving files dynamically, missing file name in "Save

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker
View previous topic :: View next topic  
Author Message
Perry Way
Guest





PostPosted: Thu Feb 05, 2004 11:22 pm    Post subject: POST, serving files dynamically, missing file name in "Save Reply with 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
Perry Way
Guest





PostPosted: Thu Feb 05, 2004 11:54 pm    Post subject: Re: POST, serving files dynamically, missing file name in "S Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Isapi-WebBroker All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.