actually... now that I look at the code closer... you're taking the file stream, copying it to a memory stream and then passing the memory stream to the request call... any reason for that? InputStream should be able to accept any IStream ... including a FileStream object... it should then be responsible for buffering and reading the stream directly.
what if you change this:
to this:Code:s3Client = New AmazonS3Client(UsrName, Pass, EndPt) 'memStream = New MemoryStream(File.ReadAllBytes(FilePath)) memStream = New MemoryStream fileStream = New FileStream(FilePath, FileMode.Open, FileAccess.Read) fileStream.CopyTo(memStream) Dim rr As New PutObjectRequest() With {.BucketName = BucketPath, .Key = Path.GetFileName(FilePath), .InputStream = memStream} Dim response As PutObjectResponse = s3Client.PutObject(rr)
-tgCode:s3Client = New AmazonS3Client(UsrName, Pass, EndPt) fileStream = New FileStream(FilePath, FileMode.Open, FileAccess.Read) Dim rr As New PutObjectRequest() With {.BucketName = BucketPath, .Key = Path.GetFileName(FilePath), .InputStream = fileStream} Dim response As PutObjectResponse = s3Client.PutObject(rr)




Reply With Quote