MqttSyncClientUploadFileAsync 方法 (String, String, String, ActionInt64, Int64, HslCancelToken) |
[文件引擎] 上传文件给服务器,需要指定上传文件的路径信息(服务器保存的名称就是文件名),以及上传到服务器的分类信息,支持进度汇报功能。
[File Engine] To upload a file to the server, you need to specify the path information of the uploaded file (the name saved by the server is the file name),
as well as the classification information uploaded to the server, to support the progress report function.
命名空间:
HslCommunication.MQTT
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public Task<OperateResult> UploadFileAsync(
string fileName,
string groups,
string fileTag,
Action<long, long> processReport,
HslCancelToken cancelToken = null
)
Public Function UploadFileAsync (
fileName As String,
groups As String,
fileTag As String,
processReport As Action(Of Long, Long),
Optional cancelToken As HslCancelToken = Nothing
) As Task(Of OperateResult)
public:
Task<OperateResult^>^ UploadFileAsync(
String^ fileName,
String^ groups,
String^ fileTag,
Action<long long, long long>^ processReport,
HslCancelToken^ cancelToken = nullptr
)
member UploadFileAsync :
fileName : string *
groups : string *
fileTag : string *
processReport : Action<int64, int64> *
?cancelToken : HslCancelToken
(* Defaults:
let _cancelToken = defaultArg cancelToken null
*)
-> Task<OperateResult>
参数
- fileName
- 类型:SystemString
文件名,需要指定完整的路径信息,文件必须存在,否则发送失败 - groups
- 类型:SystemString
文件的类别,例如 Files/Personal/Admin 按照斜杠来区分 - fileTag
- 类型:SystemString
文件的额外的描述信息 - processReport
- 类型:SystemActionInt64, Int64
进度报告,第一个参数是已完成字节数,第二个参数是总字节数 - cancelToken (Optional)
- 类型:HslCommunication.CoreHslCancelToken
取消上传操作的令牌
返回值
类型:
TaskOperateResult是否上传成功的结果对象
参见