Jump to content
irawan

idFTP.Put and permission denied

Recommended Posts

procedure TfMain.btnUploadClick(Sender: TObject);
const
  ASource: string = 'd:\tools\AnyDesk.exe';
  ADest: string = 'delete.me';
var ftp: TIdFTP;
begin //proc btnUpload
  ftp := TIdFTP.Create(nil);
  try
    ftp.Host := '192.168.110.56';
    ftp.Username := 'skak';
    ftp.Password := 'skak';
    ftp.Passive := True;
    ftp.TransferType := ftBinary;
    Lox('trying to connect...');
    ftp.Connect;
    if ftp.connected then begin
      Lox('connected');
      ftp.Put(ASource,ADest); //error here
      ftp.Disconnect;
      Lox('disconnected');
    end
    else Lox('connect fail');
  finally ftp.Free;
  end;
  Lox('job done');
end;  //proc btnUpload

i got permission denied dialog on ftp.Put(..).
something wrong is happened in my code.
but where?
please help.
ftp server is filezilla server, no ssl.

Edited by irawan
add info

Share this post


Link to post
6 hours ago, irawan said:

i got permission denied dialog on ftp.Put(..).
something wrong is happened in my code.

What is the EXACT error message?  What is the class type of the exception that is being raised? Is it EFOpenError (error on the local machine) or EIdReplyRFCError (error on the remote server)?

 

I see several possibilities,

  • you are getting a permission error trying to access the AnyDesk.exe file before the upload begins.
  • the user account you are logging into does not have write permissions on the server
  • the remote directory you are uploading to does not have write permissions.

 

Edited by Remy Lebeau

Share this post


Link to post

from 3 possibilities, it turns out the user i used has no write and delete access.
thank for pointing me to right reason why i got this error dialog.
problem solved.

error is E.ClassName: EIdReplyRFCError, E.Message: Permission denied
E is the Exception that raise on this case.
i captured using this
 

try ftp.Put(ASource,ADest); //error here        
except on E: Exception do Lox('E.ClassName: %s, E.Message: %s',[E.ClassName,E.Message]);
end; //try..except

 

Edited by irawan

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×