You can't write to the root folder. Use TPath
to find a writable folder, such as from TPath.GetTempPath()
or TPath.GetDocumentsPath()
.
Alternatively, do not use a file at all. TIdFTP.Put()
has an overloaded version that uploads a TStream
instead of a file, eg:
var
MS: TMemoryStream;
begin
MS := TMemoryStream.Create;
try
Memo1.Lines.SaveToStream(MS);
MS.Position := 0;
...
IdFTP1.Put(MS, 'filehost.txt');
...
finally
MS.Free;
end;
end;