Hello, I created an application in Delphi
, but it needs to download some files that I have on a website, but I have no idea how to do this, please help me. Ten of thanks for reading my question!
Hello, I created an application in Delphi
, but it needs to download some files that I have on a website, but I have no idea how to do this, please help me. Ten of thanks for reading my question!
You can use URLDownloadToFile
function :
// Inclua em "Uses" a unit "Urlmon"
function BaixarArquivo(const URL, SalvarComo: string): Boolean;
var
H: HRESULT;
begin
H := URLDownloadToFile(nil, pchar(URL),
pchar(SalvarComo),
0,
nil);
Result := H = S_OK;
end;
Example usage:
if BaixarArquivo('http://www.fooBAR.com/baz.poo', 'C:\baz.poo') then
ShowMessage('Arquivo baixado com sucesso!')
else
ShowMessage('Falha ao baixar arquivo.');
There is also how to do this with the component TIdHTTP
with method Get
.