Page 1 of 1

Message from Trading Partner: SFTP client file size attribute as 0 bytes

Posted: Tue 25 Sep 2018 21:13
by jeisen
I'm using Securebridge 8.2.4 with RAD Studio Tokyo 10.2.3. I'm sending files to a trading partner, they receive the file, there are no errors returned but they inform me their receiving system throws the error " SFTP client file size attribute as 0 bytes". I checked and the file is the size I expect and the contents are complete.

I don't see any SFTPClient property for file size attribute on an upload.

Any help would be greatly appreciated

Re: Message from Trading Partner: SFTP client file size attribute as 0 bytes

Posted: Fri 28 Sep 2018 07:35
by ViktorV
You can get the size of the downloaded file using the TScSFTPFileAttributes.Size property: https://devart.com/sbridge/docs/tscsftp ... s_size.htm
You can use the following recommendations to get the size of the pre-loaded file:
- Use the TScSFTPClient.OpenFile method to open a remote file and get its handle;
- get file attributes and file size using the TScSFTPClient.RetrieveAttributesByHandle method;
For example:

Code: Select all

var
  Handle: TScSFTPFileHandle;
  Attrs: TScSFTPFileAttributes;
...
  Handle := ScSFTPClient.OpenFile(GetRootDir + FileName, [foRead]);
  Attrs := TScSFTPFileAttributes.Create;
  try
    ScSFTPClient.RetrieveAttributesByHandle(Attrs, Handle, []);
  finally
    Attrs.Free;
  end;