# `MishkaGervaz.Form.Entities.Upload`
[🔗](https://github.com/mishka-group/mishka_gervaz/blob/v0.0.1-alpha.3/lib/mishka_gervaz/form/entities/upload.ex#L1)

File upload configuration — accept rules, count and size limits, plus
optional dropzone text and preview UI.

An `upload` entity is paired with a `field :name, :upload` of the
matching name, which binds the LiveView upload config to the rendered
control. Three rendering styles are supported (`:dropzone`,
`:file_input`, `:custom`), and external uploaders / chunked
transports / custom upload writers are all available for production
workloads.

## Example

    uploads do
      upload :cover do
        accept "image/*"
        max_entries 1
        max_file_size 5_000_000
        show_preview true
        auto_upload true
        dropzone_text "Drop image here"

        ui do
          label "Cover Image"
          icon "hero-photo"
          preview_class "w-32 h-32"
        end
      end
    end

See `MishkaGervaz.Form.Dsl.Uploads` for the surrounding section and
`MishkaGervaz.Form.Entities.Upload.Ui` for the `ui` sub-entity.

# `t`

```elixir
@type t() :: %MishkaGervaz.Form.Entities.Upload{
  __identifier__: term(),
  __spark_metadata__: map() | nil,
  accept: String.t() | [String.t()] | nil,
  auto_upload: boolean(),
  chunk_size: pos_integer() | nil,
  chunk_timeout: pos_integer() | nil,
  dropzone_text: String.t() | (-&gt; String.t()) | nil,
  existing: atom() | (map() -&gt; list()) | nil,
  external: (map(), Phoenix.LiveView.Socket.t() -&gt; any()) | atom() | nil,
  field: atom() | nil,
  max_entries: pos_integer(),
  max_file_size: pos_integer(),
  name: atom(),
  show_preview: boolean(),
  style: :dropzone | :file_input | :custom,
  ui: MishkaGervaz.Form.Entities.Upload.Ui.t() | nil,
  writer: atom() | nil
}
```

# `transform`

Transform the upload after DSL compilation.

Extracts the nested ui entity from the list wrapper.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
