procedure TfrmEngineerImport.btnDownloadClick(Sender: TObject);
var
vsql, SourceFile, DestFile, filename, filepath: string;
DownLoadFile: TFileStream;
vUniqry: TUniQuery;
begin
vSql := 'SELECT a.attachment_name,a.attachment_url FROM qo_order t inner join qo_order_schedule os on os.qo_order_id=t.id ' +
' inner join qo_order_sch_process p on p.qo_order_schedule_id=os.id ' +
' inner join qo_order_sch_process_atta a on a.qo_order_sch_process_id=p.id ' +
'where t.wc_contract_id=413';
ServiceDataModule.GetUniQry(vUniqry);
ServiceDataModule.OpenUniQueryBySQL(vUniqry, vSql);
with vUniqry do
begin
First;
while not Eof do
begin
filepath := fieldbyname('attachment_url').AsString;
filename := fieldbyname('attachment_name').AsString;
SourceFile := 'http://127.0.0.1:8080/' + filepath + '/' + filename;
DestFile := 'c:\img\'+filename;

{ if DownloadFile(AnsiToUtf8(SourceFile), DestFile) then
begin
mmoLog.Lines.Add(filename + ':Download succesful!')
end
else
begin
mmoLog.Lines.Add(SourceFile)
end; }
DownLoadFile := TFileStream.Create(DestFile, fmCreate);
IdHTTP1.Get(AnsiToUtf8(SourceFile), DownLoadFile);
DownLoadFile.Free;
Next;
end;
end;

ServiceDataModule.CloseUniQry(vUniqry);
end;

相关文章:

  • 2021-12-30
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
猜你喜欢
  • 2021-11-20
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
相关资源
相似解决方案