using Amazon.S3.Transfer;
using System;
using System.IO;
using System.Threading.Tasks;
namespace Amazon.DocSamples.S3
{
public class UploadFileMPUHighLevelAPITest
{
private const string bucketName = "your_bucket";
private const string filePath = @"D:\mydata\s3_upload_text.txt";
public void ExecS3()
{
try
{
AmazonS3Client lamcs3 = new AmazonS3Client("key", "secret_key",RegionEndpoint.SAEast1);
var fileTrasnferUtility = new TransferUtility(lamcs3);
TransferUtilityUploadRequest ltup = new TransferUtilityUploadRequest();
ltup.FilePath = filePath;
ltup.BucketName = "your bucket";
//prod/teste.txt is direcotry and the name of the file I want s3_upload_text.txt to be stored.
fileTrasnferUtility.Upload(filePath, "your bucket","prod/teste.txt");
}
catch(Exception ex)
{
Console.Write(ex.Message);
}
}
}
}
Nenhum comentário:
Postar um comentário