irawan 2 Posted Saturday at 02:19 PM (edited) 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 Saturday at 02:48 PM by irawan add info Share this post Link to post
Remy Lebeau 1494 Posted Saturday at 08:19 PM (edited) 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 Saturday at 08:23 PM by Remy Lebeau Share this post Link to post
irawan 2 Posted Sunday at 12:48 AM (edited) 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 Sunday at 01:13 AM by irawan Share this post Link to post