TsgcWSPClient_FilesMethods › SendFile

SendFile Method

Uploads a file to the server in fragmented chunks with configurable QoS.

Overloads

Overload 1

Syntax

procedure SendFile(aFileName: String; aSize: Integer; aQoS: TwsQoS; aData: String; aFileId: String = '');

Parameters

NameTypeDescription
aFileNameStringFull path to the local file that will be uploaded.
aSizeIntegerSize in bytes of every fragment sent to the server. Pass 0 to send the file in a single chunk.
aQoSTwsQoSQuality of service: qosLevel0 fire-and-forget, qosLevel1 acknowledged, qosLevel2 acknowledged with fragment-request and resume support.
aDataStringFree-form custom payload forwarded to the server (for example a destination path, tag or auth token).
aFileIdStringOptional file identifier; when empty a new Guid is assigned automatically.

Remarks

Full-control overload. OnFileBeforeSent fires before the header leaves, OnFileSentFragmentRequest fires per fragment and OnFileSent fires when the server confirms reception. For qosLevel2 the transfer is queued so it can resume after a reconnection.

Example

oProtocol.SendFile('C:\photos\beach.jpg', 32768, qosLevel2, 'album=holiday');

Overload 2

Syntax

procedure SendFile(aFileName: String);

Parameters

NameTypeDescription
aFileNameStringFull path to the local file that will be uploaded.

Remarks

Convenience overload that reuses the defaults declared in Files.BufferSize and Files.QoS.Level, leaving the custom data and file id empty.

Example

oProtocol.SendFile('C:\reports\report.pdf');

Back to Methods