//引入命名空间:
using
Aliyun.OSS;
using
Aliyun.OSS.Common;
//定义阿里云OSS接口参数:
private
string
AccessKeyId =
"xxx"
;
//阿里云AccessKeyId
private
string
AccessKeySecret =
"xxx"
;
//阿里云AccessKeySecret
private
string
OssEndpoint =
"http://oss-cn-xxx.aliyuncs.com"
; //阿里云Endpoint
private
string
OssBucket =
"xxx"
;
//阿里云Bucket
private
static
OssClient aliyunclient;
//阿里云OSS连接对象
static
int
partSize = 50 * 1024 * 1024;
//分片上传大小
//创建阿里云OSS客户端连接:
aliyunclient =
new
OssClient(
this
.OssEndpoint,
this
.AccessKeyId,
this
.AccessKeySecret);
分片上传文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
分片上传函数定义:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
注意事项:
阿里云上目标文件路径开头不能是“/”