View Source Uploadex.S3Storage (Uploadex v3.1.0)
Storage for AWS S3.
Opts
bucket
: String (required for all functions)region
: String (required forUploadex.Storage.get_url/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
). Ifcontent_type
is not specified inupload_opts
, the default is the upload's content type.
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", region: "sa-east-1", upload_opts: [acl: :public_read]]
def storage(%User{} = user, :photo), do: {Uploadex.S3Storage, directory: "/photos"}