我有一个工作流程将zip文件上传到我的FTP服务器。我喜欢我的程序解压缩它,而不是我必须登录我的托管文件管理器并手动提取它。我一直在网上搜索Indy文档,但没有取得任何成功。
function UnzipUploadedFile: Boolean;
begin
Result := False;
//i don't know what to do next...
end;
function UploadZippedMediaAssets (sFile: String; lblEcho: TLabel; nFTP: TIdFTP): Boolean;
var s: String;
begin
Result := False;
if ConnectToFTPServer (nFTP, False, s) then
begin
Talk (lblEcho, 'FTP connected to ' + nFTP.Username + '@' + nFTP.Host);
end
else
begin
Talk (lblEcho, s);
Exit;
end;
try
nFTP.ChangeDir('/');
nFTP.ChangeDir('upload/');
nFTP.TransferType := ftBinary;
Talk (lblEcho, 'uploading ' + sFile);
nFTP.Put (sFile, ExtractFileName(sFile), False, -1);
Talk (lblEcho, 'unzipping ' + ExtractFileName(sFile));
//this is where I'm stuck
Result := UnzipUploadedFile;
except on e:Exception do
begin
Talk (lblEcho, sFile + ' failed: ' + e.Message);
end;
end;
end;
非常感谢任何关于完成此任务所需的组件和/或代码的方向!