Article View: borland.public.cppbuilder.internet.socket
Article #3908TIdHTTPServer and ServeFile
From: Lapo Guidi
Date: Thu, 19 May 2005 01:20
Date: Thu, 19 May 2005 01:20
30 lines
2122 bytes
2122 bytes
Hi all, I made a small and simple HTTP Server using Indy. I would like to send a file to the client (eg. test.zip). Browser ask to receive the file using a sort of dynamic page called sendfile.html with parameter. In other words the url requested from the client is that: http://localhost/sendfile.html?name=test.zip The problem I have is that: If I click over the link in a page using the client (Internet Explorer), the zip file is written on the html page. If I right-click on the link and I choose "Save target as..." the zip is correctly saved where I want, but the name is sendfile.html. I use this row of code in the OnCommandGet: HTTP->ServeFile(AThread, AResponseInfo, "c:\\test.zip"); but I tried also sending the file using ContentStream properties and the result is the same. In two words, when I click on a link to request a file, it's displayed over the browser (instead of saved on disk) and if I right-click on the link, the file is saved but with a wrong filename. What I'm do wrong? What's the right procedure to send a file requested with a sort of dynamic page? I hope I was sharp enough. Thanks very much Lapo
Technical Details
Message-ID:
<428be9c6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e3a37c22dc9da9c8,start X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Lapo Guidi" <lapoguidi@inwind.it> Newsgroups: borland.public.cppbuilder.internet.socket Subject: TIdHTTPServer and ServeFile Date: Thu, 19 May 2005 03:20:08 +0200 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 82.49.69.253 Message-ID: <428be9c6@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1116465606 82.49.69.253 (18 May 2005 18:20:06 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail