/// 拷贝一个分片 public void UploadPartCopy() { //.cssg-snippet-body-start:[upload-part-copy] try { string sourceAppid = "1250000000"; //账号 appid string sourceBucket = "sourcebucket-1250000000"; //"源对象所在的存储桶 string sourceRegion = "COS_REGION"; //源对象的存储桶所在的地域 string sourceKey = "sourceObject"; //源对象键 //构造源对象属性 COSXML.Model.Tag.CopySourceStruct copySource = new CopySourceStruct(sourceAppid, sourceBucket, sourceRegion, sourceKey); string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID string key = "exampleobject"; //对象键 string uploadId = this.uploadId; //初始化分块上传返回的uploadId int partNumber = 1; //分块编号,必须从1开始递增 UploadPartCopyRequest request = new UploadPartCopyRequest(bucket, key, partNumber, uploadId); //设置拷贝源 request.SetCopySource(copySource); //设置复制分块(指定块的范围,如 0 ~ 1M) request.SetCopyRange(0, 1024 * 1024); //执行请求 UploadPartCopyResult result = cosXml.PartCopy(request); //请求成功 //获取返回分块的eTag,用于后续CompleteMultiUploads this.eTag = result.copyObject.eTag; Console.WriteLine(result.GetResultInfo()); } catch (COSXML.CosException.CosClientException clientEx) { //请求失败 Console.WriteLine("CosClientException: " + clientEx); } catch (COSXML.CosException.CosServerException serverEx) { //请求失败 Console.WriteLine("CosServerException: " + serverEx.GetInfo()); } //.cssg-snippet-body-end }