Menu

TDPFHttp and download binary data (pdf, zip ...)

luca
2013-10-21
2013-10-22
  • luca

    luca - 2013-10-21

    How can I use TDPFHttp object to download binary data from a web server?

     
  • luca

    luca - 2013-10-21

    I try also Indy but it doesn't work.
    The file exists but it's not loaded.
    If anybody can help.

    procedure TFWebView.DPFButton2Click(Sender: TObject);
    var
    Http: TIdHTTP;
    MS: TMemoryStream;
    begin
    Http := TIdHTTP.Create(nil);
    try
    MS := TMemoryStream.Create;
    try
    //Http.OnWork:= HttpWork;

      Http.Get('http://www.webdomino.it/test1.jpg', MS);
      MS.SaveToFile(GetAppFolder + 'test1.jpg');
    
      if fileexists(GetAppFolder + 'test1.jpg') then
      begin
        DPFImageView1.ImageList.Clear;
        DPFImageView1.LoadAsync := true;
        DPFImageView1.ImageList.Add(GetAppFolder + 'test1.jpg' );
        DPFImageView1.ReloadImage;
      end;
    
    finally
      MS.Free;
    end;
    

    finally
    Http.Free;
    end;

    end;

     
  • Babak Yaghoobi

    Babak Yaghoobi - 2013-10-22

    Hi luca

    Download last source [code] and see DownloadFile Demo!

    Regards

     

    Related

    Code: code


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.