How to specify a prefix when loading on S3 using direct loading of activestorage?

With standard S3 configuration:

AWS_ACCESS_KEY_ID:        [AWS ID]
AWS_BUCKET:               [bucket name]
AWS_REGION:               [region]
AWS_SECRET_ACCESS_KEY:    [secret]

I can upload the file to S3 (using direct download) with this Rails 5.2 code (only the corresponding code is displayed):

form.file_field :my_asset, direct_upload: true

This will effectively put my asset on the root of my S3 bucket after submitting the form.

How can I specify a prefix (for example, "development /" so that I can simulate a folder on S3)?

+4
source share
1 answer

Sorry, this is not yet. Id suggests creating backup storage for active storage that will be used exclusively.

+3
source

Source: https://habr.com/ru/post/1692550/


All Articles