No sorry. It is way over my head. Maybe someone have a Delphi example they can share with me. My experience level is simply to low.
I want to use Francois Piette's Webserver Demo app to take the user inputs received from form.htm and based on the user response 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 called one.pdf (not a html page) and therefore expect the client' s browser to bring up a save file dialog automatically. If there is anybody with such a example, pleeeeeezzzzzzz. Juri Keyter > OOPS! You need to write: > > "Content-Length: " + DocumentToContentType(FDocument) + "\r\n" > > SZ > > ----- Original Message ----- > From: "Fastream Technologies" <[EMAIL PROTECTED]> > To: "ICS support mailing" <twsocket@elists.org> > Sent: Wednesday, December 07, 2005 5:39 PM > Subject: Re: [twsocket] Sending a file with HTTPSERVER as response > > >>I think to achieve your goal, you may need something like: >> >> String contentLength = "Content-Length: " + >> String(Body.Length()) + "\r\n"; >> String Header(FVersion + " 500 Server Error\r\n" + >> contentLength + >> "Content-Type: text/html\r\n" + >> "Connection: " + FRequestConnection + "\r\n" + >> "Server: " + serverString + "\r\n\r\n" >> ); >> >> PutStringInSendBuffer(Header); >> SendStream(); >> >> Do not forget to assign the file stream to FDocStream prior to calling >> SendStream(). For this code to work, you need to set hgSendStream to >> Flags. >> This is all needed because you have to construct the response header >> manually. There should be an easier way for your simple need but I told >> that >> to you and it did not work, so this is a work around. I use technique >> for >> caching (I assign TmemoryStream to FDocStream) in our web server. >> >> Best Regards, >> >> SZ >> >> ----- Original Message ----- >> From: <[EMAIL PROTECTED]> >> To: "ICS support mailing" <twsocket@elists.org> >> Sent: Wednesday, December 07, 2005 5:33 PM >> Subject: Re: [twsocket] Sending a file with HTTPSERVER as response >> >> >>>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 >> >> -- >> 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