Title: Download Binary File from a Web Server. Post by: SteveG on December 16, 2014, 02:27:09 AM Hi Danijel,
I have created a web server using a TRtcHTTPServer component and TRtcDataProvider components. In a web browser, users are able to right click on a link and download a text file. This works fine. The code I used is: Code:
I also want users to be able to download a binary file. I have tried a few different ways but the file doesn't download. What is the correct method for downloading binary files? Thanks. = Steve Title: Re: Download Binary File from a Web Server. Post by: D.Tkalcec (RTC) on December 16, 2014, 05:13:01 AM The key to sending different content to the Web Browser is to set the correct Response Content Type header. If you do not set the Response Content Type header, Web Browser will assume that you are sending a HTML file. Different file types will require a different ContentType value to be handled properly by the Web Browser. For a working example on sending files of different types to Web Browsers, check the File_Server or the RTC_WebServer Demo, which use the File Provider implemented in the DataProviders\rtcFileProvider.pas unit.
Best Regards, Danijel Tkalcec Title: Re: Download Binary File from a Web Server. Post by: SteveG on December 16, 2014, 05:57:11 AM Ah, of course. Thanks Danijel! It was easier than I thought.
Regards, Steve |