Page 1 of 1

SFTP upload/download exception question

Posted: Tue 11 Dec 2012 19:50
by snorkel
Hi,
When I am doing a upload or download and I have the overwrite option set to false
How can I detect in the try except that it was related to the file overwrite and
not some other error like the connection failed?
I want to timestamp the file if it exists

Code: Select all

try
FSFTP.UploadFile(sourcefile,destfile,false);
except
    on e:EScSFTPError do 
       showmessage(e.error);
end;

Re: SFTP upload/download exception question

Posted: Tue 05 Feb 2013 13:18
by Dimon
The point is that different SFTP servers return different errors, which also depend on a situation. Therefore, in your case, you need to handle the TScSFTPClient.OnError event. Check that the Operation parameter is equal to opOpeningFile in this event handler and process the error message.