Ejemplo n.º 1
0
        public override Task <StorageUploadParameters> RequestUpload(RequestUploadOptions options)
        {
            var headers = new Dictionary <string, string>();

            if (options.Length > 0)
            {
                headers.Add("Content-Length", options.Length.ToString());
            }

            var url = cos.GenerateSignURL(new COSXML.Model.Tag.PreSignatureStruct
            {
                isHttps    = true,
                httpMethod = "PUT",
                appid      = cosConfig.Appid,
                bucket     = this.bucket,
                region     = cosConfig.Region,
                headers    = headers,
                key        = options.DestFilePath,
            });

            return(Task.FromResult(new StorageUploadParameters
            {
                Url = url,
                Method = "PUT"
            }));
        }
Ejemplo n.º 2
0
        public virtual async Task PutFile(RequestUploadOptions options, string srcFilePath)
        {
            var p = await RequestUpload(options);

            using (var fs = File.OpenRead(srcFilePath))
            {
                await new HttpClient().PutAsync(p.Url, new StreamContent(fs));
            }
        }
Ejemplo n.º 3
0
 public virtual Task <StorageUploadParameters> RequestUpload(RequestUploadOptions options)
 {
     throw new NotImplementedException();
 }