Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : problem loading pictures of web page using TidHTTPServer and TPageProducer

www.cryer.info
Managed Newsgroup Archive

problem loading pictures of web page using TidHTTPServer and TPageProducer

Subject:problem loading pictures of web page using TidHTTPServer and TPageProducer
Posted by:"Glen Welch" (gl..@custommadesoftware.co.nz)
Date:Wed, 28 Jun 2006 13:08:04 +1200

Following is some code I am using to fill in Tags from a web page - then
send it using TidHTTPServer.
Im not sure if this is the best way of doing this but I cant get it to work
at all.
If there is a better way of filling in tags then please let me know cause as
you can see I am having to save out to the tempary file.

htmlPageProducer: TPageProducer;
HTTPServer: TIdHTTPServer;

  if FileExists(LocalDoc) then // File exists
  begin
    htmlPageProducer.HTMLFile:= LocalDoc;
    TempFileName:= ChangeFileExt(LocalDoc, '.tmp');
    TempFile:= TStringList.Create;
    try
      TempFile.Add(htmlPageProducer.Content);
      TempFile.SaveToFile(TempFileName);
    finally
      TempFile.Destroy;
    end;
    HTTPServer.ServeFile(AThread, AResponseInfo, TempFileName);
  end;

Problem is that images are not being displayed.

If i use
    HTTPServer.ServeFile(AThread, AResponseInfo, LocalDoc);
all works fine

Thanx in advance.

Replies:

www.cryer.info
Managed Newsgroup Archive