Hello after successfully uploading the files to a ftp server I'm unable to
delete them. I get error 5, acces denied,

What can I do? Should I use a delay before trying to delete the file?
Thank you!

This is the code that I use:

procedure
incarcare_fisier_pe_ftp_prin_icsftp(nume_fisier,host_ftp,port_ftp,username_ftp,password_ftp,directory_ftp:string;memo_loguri:Tmemo);
var
  icsFtp: TFtpClient;
  nume_fisier_initial,numele_fisierului_redenumit:string;
begin
icsFtp := TFtpclient.Create(nil);
  try

    icsFtp.OnProgress64 := form1.icsFtpONProgress;
    icsftp.OnDisplay:= form1.DisplayHandler;

    icsFtp.HostName := host_ftp;
    icsftp.Port:=port_ftp;
    icsFtp.UserName := username_ftp;
    icsFtp.PassWord := password_ftp;
    icsFtp.LocalFileName := nume_fisier;
    icsFtp.HostDirName := directory_ftp;
    icsFtp.HostFileName := ExtractFileName(icsFtp.LocalFileName);
    icsFtp.BandwidthLimit := 0;
    icsFtp.Passive := True;
    icsFtp.Binary := True;
    icsFtp.MultiThreaded := true;

    form1.Log('start conectare la "' + icsFtp.HostName+'"');
    if not icsFtp.Connect then
    begin
      form1.Log('eroare de conectare la "' + icsFtp.HostName + '" => ' +
icsFtp.LastResponse);
      Exit;
    end;

    try
      form1.Log('conectat cu succes la "' + icsFtp.HostName+'"');

      form1.Log('start incarcare fisier "' + icsFtp.HostFileName + '"');

      if icsftp.cwd then  begin
        form1.Log('directorul curent a fost schimbat cu succes in
"'+icsftp.HostDirName+'" => '+icsftp.LastResponse);
        end else
      begin
        form1.Log('eroare la schimbarea directorului curent
"'+icsftp.HostDirName+'" => '+icsftp.LastResponse);
      end;


      if icsFtp.Put then begin
        form1.Log('incarcat cu succes "' + icsFtp.HostFileName + '"');
        form1.Log('sterg fisierul "'+icsFtp.HostFileName+ '"');
        {sterg fisierul}
        if DeleteFile(nume_fisier) then form1.Log('fisierul
"'+nume_fisier+'" a fost STERS')
                     else form1.Log('fisierul "'+nume_fisier+'" nu a putut
fi sters => EROARE: '+IntToStr(GetLastError));
      end else begin
        form1.Log('eroare la incarcarea fisierului "' + icsFtp.HostFileName
+ '" => ' + icsFtp.LastMultiResponse);
      end;
    finally
      form1.Log('inchid conexiunea cu serverul de ftp');
      icsFtp.Quit;
    end;
  finally
    icsFtp.Free;
  end;
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to