Hello,

You need to use the hgSendDoc which is the default mode for GET/HEAD. Just 
change the DefaultDoc to the file you want. If there is no match for the 
MIME type in Francois' DocumentToContentType function, then you need to 
build your own header and use sendstream instead.

Best Regards,

SZ

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <twsocket@elists.org>
Sent: Tuesday, December 06, 2005 10:10 PM
Subject: [twsocket] Sending a file with HTTPSERVER as response


> Hi All
>
> I am playing with the ICS WebServ server demo and need some help. I want
> to use the user inputs received from form.htm and based on the user
> responses provide a file to the web client for download. When the user
> types "one" in the first name field as example, I want the server to send
> him a file (not a html page) and therefore expect the clients browser to
> bring up a save file dialog automatically. This is what I have in mind:
>
> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> * *
> *}
> { This will process posted data for
>             }
> { Data is saved in FormHandler.txt
>      }
> procedure TWebServForm.ProcessPostedData_FormHandler(
>    ClientCnx : TMyHttpConnection);
> var
>    Stream    : TStream;
>    FileName  : String;
>    FirstName : String;
>    LastName  : String;
>    HostName  : String;
>    Buf       : String;
>    Dummy     : THttpGetFlag;
> begin
>    { Extract fields from posted data. }
>    ExtractURLEncodedValue(ClientCnx.FPostedDataBuffer, 'FirstName',
> FirstName);
>    ExtractURLEncodedValue(ClientCnx.FPostedDataBuffer, 'LastName',
> LastName);
>    If FirstName:= 'one' then ----------now send him the file one.exe
>    If FirstName:= 'two' then ----------now send him the file two.exe
>
> Your help is highly appreciated.
>
> Regards
>
> Juri Keyter
>
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to