MultipartUpload() public méthode

public MultipartUpload ( MultiUploadRequestData multiUploadObject, Action uploadProcessCallback = null, CancellationToken cancellationToken = null ) : Task
multiUploadObject MultiUploadRequestData
uploadProcessCallback Action
cancellationToken System.Threading.CancellationToken
Résultat Task
Exemple #1
0
        static async void MultipartUploadInitiate()
        {
            try
            {
                OssClient temp   = new OssClient("bm9crcnr0rtnuw8bnrfvq7w8", "RbtJoExTnA8vYLynUfDh7Ior+oM=");
                string    result = await temp.MultipartUploadInitiate("devdoc", "c# 5.0.pdf");

                FileStream fs = new FileStream(@"c# 5.0.pdf", FileMode.Open);

                byte[] buffer = new byte[6291456];

                ReadChunk(fs, buffer);

                MemoryStream ms = new MemoryStream(buffer);

                MultiUploadRequestData arg = new MultiUploadRequestData()
                {
                    Bucket = "devdoc", Key = "c# 5.0.pdf", Content = ms, PartNumber = "1", UploadId = result
                };
                MultipartUploadResult result1 = await temp.MultipartUpload(arg, callback);

                ListMultipartUploadsResult listMultipart = await temp.ListMultipartUploads("devdoc");

                //  temp.DeleteMultipartUpload(arg);

                //fs.Position = 6291456;
                //arg = new MultiUploadRequestData() { Bucket = "devdoc", Key = "c# 5.0.pdf", Content = fs, PartNumber = "2", UploadId = result };
                //MultipartUploadResult result2 = await temp.MultipartUpload(arg);

                //ListPartsResult parts = await temp.ListMultiUploadParts("devdoc", "c# 5.0.pdf", result);


                //CompleteMultipartUploadModel model = new CompleteMultipartUploadModel();

                //model.Parts = new List<MultipartUploadPartModel>();
                //model.Parts.Add(new MultipartUploadPartModel(1, result1.ETag));
                //model.Parts.Add(new MultipartUploadPartModel(2, result2.ETag));
                //model.Bucket = "devdoc";
                //model.Key = "c# 5.0.pdf";
                //model.UploadId = result;


                //temp.CompleteMultipartUpload(model);

                //  fs.Dispose();
            }
            catch (AggregateException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        static async void MultipartUploadInitiate()
        {
            try
            {
                OssClient temp = new OssClient("bm9crcnr0rtnuw8bnrfvq7w8", "RbtJoExTnA8vYLynUfDh7Ior+oM=");
                string result = await temp.MultipartUploadInitiate("devdoc", "c# 5.0.pdf");

                FileStream fs = new FileStream(@"c# 5.0.pdf", FileMode.Open);

                byte[] buffer = new byte[6291456];

                ReadChunk(fs, buffer);

                MemoryStream ms = new MemoryStream(buffer);

                MultiUploadRequestData arg = new MultiUploadRequestData() { Bucket = "devdoc", Key = "c# 5.0.pdf", Content = ms, PartNumber = "1", UploadId = result };
                MultipartUploadResult result1 = await temp.MultipartUpload(arg, callback);

               ListMultipartUploadsResult  listMultipart  = await temp.ListMultipartUploads("devdoc");

              //  temp.DeleteMultipartUpload(arg);

                //fs.Position = 6291456;
                //arg = new MultiUploadRequestData() { Bucket = "devdoc", Key = "c# 5.0.pdf", Content = fs, PartNumber = "2", UploadId = result };
                //MultipartUploadResult result2 = await temp.MultipartUpload(arg);

                //ListPartsResult parts = await temp.ListMultiUploadParts("devdoc", "c# 5.0.pdf", result);


                //CompleteMultipartUploadModel model = new CompleteMultipartUploadModel();

                //model.Parts = new List<MultipartUploadPartModel>();
                //model.Parts.Add(new MultipartUploadPartModel(1, result1.ETag));
                //model.Parts.Add(new MultipartUploadPartModel(2, result2.ETag));
                //model.Bucket = "devdoc";
                //model.Key = "c# 5.0.pdf";
                //model.UploadId = result;


                //temp.CompleteMultipartUpload(model);

              //  fs.Dispose();

            }
            catch (AggregateException ex)
            {
                Console.WriteLine(ex.Message);

            }
        }