我正在使用AWS S3来存储文件。 我能够上传和删除文件。 唯一的问题是上传大文件时,如何知道上传了多少,我需要实现进度条。
请帮我做。
IAmazonS3 client = new AmazonS3Client(RegionEndpoint.USEast2);
TransferUtility utility = new TransferUtility(client);
TransferUtilityUploadRequest request = new TransferUtilityUploadRequest();
if (subDirectoryInBucket == "" || subDirectoryInBucket == null)
{
request.BucketName = bucketName; //no subdirectory just bucket name
}
else
{ // subdirectory and bucket name
request.BucketName = bucketName + @"/" + subDirectoryInBucket;
}
request.Key = RandomString()+ Path.GetExtension(e.File.FileName); //file name up in S3
request.InputStream = e.File.InputStream;
request.CannedACL=S3CannedACL.PublicRead;
utility.Upload(request); //commensing the transfer
我正在使用此代码。
答案 0 :(得分:0)
您可以使用方法调用TransferUtilityUploadRequest,
下面是示例,您也可以参考此link!希望这有帮助
public string CheckInAndOut { get { return CheckIn + " " + CheckOut; } }