Skip to content

How to upload the multipart file directly to the AWS S3 bucket using echo framework? #1912

Answered by aldas
sriramkp asked this question in Q&A
Discussion options

You must be logged in to vote

Combine
start of this https://echo.labstack.com/cookbook/file-upload/
with that https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/go/example_code/s3/s3_upload_object.go

also you could modify this Gin example for Echo https://medium.com/wesionary-team/aws-sdk-for-go-and-uploading-a-file-using-s3-bucket-df7425317a40

or use SDK example https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#example_NewUploader_overrideReadSeekerProvider

	file, err := c.FormFile("file")
	if err != nil {
		return err
	}
	src, err := file.Open()
	if err != nil {
		return err
	}
	defer src.Close()
	sess := session.Must(session.NewSession())

	uploader := s3manager.NewUploader(sess, func(u *s3m…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sriramkp
Comment options

Answer selected by sriramkp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants