I've got a working process to upload a zip file to my FTP server. I'd like my program to unzip it, rather than me having to log in to my hosting file manager and manually extract it. I've been searching online and through the Indy documentation, but haven't had any success.
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;
Any direction as to what components and/or code is necessary to get this done would be greatly appreciated!