ApiBaseUploadFileWithProgressAsync(String, String, ActionDouble, DictionaryString, String, CancellationToken) Method

Uploads a file to the specified URL with progress reporting.

Definition

Namespace: GenerativeAI.Core
Assembly: GenerativeAI (in GenerativeAI.dll) Version: 2.0.2+aa51399cad6d90cc71158d589a6268608b3c1893
C#
protected Task<string> UploadFileWithProgressAsync(
	string url,
	string filePath,
	Action<double> progress,
	Dictionary<string, string>? additionalHeaders = null,
	CancellationToken cancellationToken = default
)

Parameters

url  String
The full URL of the API endpoint.
filePath  String
The local path to the file to be uploaded.
progress  ActionDouble
A callback function to report upload progress as a percentage.
additionalHeaders  DictionaryString, String  (Optional)
Optional. Additional headers to add to the request.
cancellationToken  CancellationToken  (Optional)
Token to propagate notification that the operation should be canceled.

Return Value

TaskString
The server's response as a string.

See Also