import { BusinessError } from '@kit.BasicServicesKit';
let uploadFromFile: rcp.UploadFromFile = {
fileOrPath: "http://huawei.com"
}
const session = rcp.createSession();
session.uploadFromFile("http://huawei.com", uploadFromFile).then((response) => {
console.info(`Response succeed: ${response}`);
}).catch((err: BusinessError) => {
console.error(`err: err code is ${err.code}, err message is ${JSON.stringify(err)}`);
});
上面是官网的示例代码只能上传一个文件,rcp能不能一次性上传多个文件?
rcp不能一次性上传多个文件,上传下载建议使用@ohos.request支持多文件上传:
https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-request-V5\#requestuploadfile9