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

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
jeisen
Posts: 12
Joined: Sat 14 Feb 2015 20:15

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

Post by jeisen » Tue 25 Sep 2018 21:13

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

ViktorV
Devart Team
Posts: 2580
Joined: Wed 30 Jul 2014 07:16

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

Post by ViktorV » Fri 28 Sep 2018 07:35

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;

Post Reply