File Upload
Drag-and-drop file upload built on Phoenix LiveView uploads.
Document Dropzone
Image Upload With Thumbnails
Set
thumbnail
to render image previews using Phoenix's
live_img_preview/1
— perfect for photo galleries and avatars.
Image Upload
Single File
Use
max_entries: 1
in
allow_upload/3
for single-file uploads like avatars. Combined with
thumbnail
, it makes a clean profile photo
picker.
Avatar Upload
Custom Dropzone Content
Override the default icon and label with the
:drop_content
slot. The dropzone keeps its drag-and-drop behavior — you just control
what's shown inside.
Custom Content
Notes
-
Configure accepted types, max entries, and max size in
allow_upload/3before rendering the component. -
Always wrap
file_uploadin a<form>withphx-changeandphx-submit— the upload entries are processed via the form lifecycle. -
Call
consume_uploaded_entries/3in your save handler to copy files to their final destination. -
The
cancel_eventattr (default"cancel-upload") must be handled to remove entries — it receivesuploadandrefparams forcancel_upload/3. -
Use the
:entryslot when you need a fully custom preview row.