I have tried the following: ClientCnx.FDocument:='c:\1.zip'; ClientCnx.SendDocument(HttpSendDoc);
When I send the request from the browser, the file is displayed in the browser in asci format and the browser does not come up with a save dialog. I dont have a C++ compiler (dont know much about it either) but if you can just send me a extract then I am sure I can figure it out. Thank you for taking the time to assist. Regards Juri Keyter > Here is what I do. After I receive the file with OnPostedData, I manually > call SendDocument within the same event. You need to check for socket > errors > and content-length (FRequestContentLength). > > If you need more examples, let me know if you can read C++. > > Best Regards, > > SZ > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Wednesday, December 07, 2005 11:16 AM > Subject: Re: [twsocket] Sending a file with HTTPSERVER as response > > >> Hi >> >> Thank you for the prompt response. Can you give me a small example on >> how >> to use hgSendDoc? I can see it is a flag but I have no idea how to >> implement it. With a small one line example I will manage to figure it >> out. >> >> Thank you >> >> >> >> >> Juri Keyter >> >>> 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 >>> >> >> -- >> 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 > -- 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