Page 1 of 1

Put file through ScSFTPClient from Stream.

Posted: Wed 03 Feb 2010 16:20
by hjorturb
Hi

Is there any way to send a StringList through ScSFTPClient and store as a file on the sFtp site? I have to do it that way since I am not allowed to store it in file because of content of the stringlist.

Best regards,

Hjortur.
Iceland.

Posted: Thu 04 Feb 2010 02:50
by hjorturb
I can see there is a Procedure that is called "WriteFile". Has anyone some example code to use that one?

Best regards,
Hjortur.

Posted: Thu 04 Feb 2010 09:07
by Dimon
You can use the following code:

Code: Select all

Handle := ScSFTPClient.OpenFile(Fielname, [foCreate, foRead, foWrite]);
s := StringList.Text;
ScSFTPClient.WriteFile(Handle, 0, s[1], Length(s));
ScSFTPClient.CloseHandle(Handle);