扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:cokeyang 来源:csdn 2007年10月31日
关键字:
procedure Get(const ASourceFile: string; ADest: TStream; AResume: Boolean); overload; procedure Get(const ASourceFile: string; const ADestFile: string; const ACanOverwrite: boolean; AResume: Boolean); overload; |
const ASourceFile: string |
const ADestFile: string |
const ACanOverwrite: boolean = false |
AResume: Boolean = false |
SaveDialog1.FileName := Name; if SaveDialog1.Execute then begin SetFunctionButtons(false); IdFTP1.TransferType := ftBinary; BytesToTransfer := IdFTP1.Size(Name); if FileExists(Name) then begin case MessageDlg('File aready exists. Do you want to resume the download operation?', mtConfirmation, mbYesNoCancel, 0) of mrYes: begin BytesToTransfer := BytesToTransfer - FileSizeByName(Name); IdFTP1.Get(Name, SaveDialog1.FileName, false, true); end; mrNo: begin IdFTP1.Get(Name, SaveDialog1.FileName, true); end; mrCancel: begin exit; end; end; end else begin IdFTP1.Get(Name, SaveDialog1.FileName, false); end; |
procedure Put(const ASource: TStream; const ADestFile: string; const AAppend: boolean); overload; procedure Put(const ASourceFile: string; const ADestFile: string; const AAppend: boolean); overload; |
const ASourceFile: string |
const ADestFile: string = '' |
const AAppend: boolean = false |
if IdFTP1.Connected then begin if UploadOpenDialog1.Execute then try IdFTP1.TransferType := ftBinary; IdFTP1.Put(UploadOpenDialog1.FileName, ExtractFileName(UploadOpenDialog1.FileName)); //可以在此添加改变目录的代码; finally //完成清除工作 end; end; |
procedure Delete(const AFilename: string); |
procedure RemoveDir(const ADirName: string); |
if not IdFTP1.Connected then exit; Name := IdFTP1.DirectoryListing.Items[iCurrSelect].FileName; if IdFTP1.DirectoryListing.Items[iCurrSelect].ItemType = ditDirectory then try idftp1.RemoveDir(Name); finally end else try idftp1.Delete(Name); finally end; |
//取消按钮的OnClick响应 procedure TMainForm.AbortButtonClick(Sender: TObject); begin AbortTransfer := true; end; //IdFTP的OnWork事件响应 procedure TMainForm.IdFTP1Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer); begin ... if AbortTransfer then IdFTP1.Abort; AbortTransfer := false; end; |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者