Uploadex v1.0.1 Uploadex.S3Storage View Source
Storage for AWS S3.
Opts
bucket
: String (required forUploadex.Storage.store/2
andUploadex.Storage.delete/2
)directory
: String (required for all functions)upload_opts
: Keyword list. This opts are passed toExAws.S3.upload/4
andExAws.S3.put_object/4
(required forUploadex.Storage.store/2
)base_url
: String (required forUploadex.Storage.get_url/2
)
Example
To use this storage for your User
record, define these functions in your Uploadex.Uploader
implementation:
def default_opts(Uploadex.S3Storage), do: [bucket: "my_bucket", base_url: "https://my_bucket.s3-sa-east-1.amazonaws.com", upload_opts: [acl: :public_read]]
def storage(%User{} = user), do: {Uploadex.S3Storage, directory: "/photos"}