Skip to content

How to add multiple files to one field? #42

@aMytho

Description

@aMytho

I have a project where users can upload html/css/js files to be displayed to other users. I'm having trouble getting it to allow multiple files for one field. I can get around it by zipping the file but then I have to unzip it whenever it is served to a user which isn't ideal.

I'm assuming I have to do something like
field :interactive_project {:array, Glimesh.Interactive.Type}
Then in migrations
add :interactive_project, {:array, :string}

This does compile but I don't know how to cast the attachment. It seems to only allow 1 file for that.

# Other validations...
changeset |> cast_attachments(attrs, [:poster, :chat_bg, :interactive_project])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions