I was trying to upload files using Aws sdk rails gem.
Everything is successful except I can not find a way how to upload files to a specific folder using ruby sdk.
s3 = Aws::S3::Resource.new
obj = s3.bucket('storagy-teen-dev-us').object("deepak_file")
obj.upload_file('./tmp/aws_test.txt')
This works fine. But I want to create the deepak_file
inside a particular directory in aws bucket, let's say photos
. I already tried the below but not working.
obj = s3.bucket('storagy-teen-dev-us').object("photos/deepak_file")
Try this,
s3 = Aws::S3::Resource.new
path = 'photos/deepak_file/aws_test.txt'
s3.bucket('storagy-teen-dev-us').object(path).upload_file(./tmp/aws_test.txt)
you just need to specify full path of directory with file name.