File Upload

files

<.phx_form_for for={%{}} as={:story} :let={f}>
  <.file_upload_input_group
    form={f}
    name={:file}
    upload_config={%Phoenix.LiveView.UploadConfig{accept: ".jpg, .png", ref: "upload-input"}}
    upload_progress={0}
   />
</.phx_form_for>

A file may take up to 5 minutes to upload.

50 MB max

<.phx_form_for for={%{}} as={:story} :let={f}>
  <.file_upload_input_group
    form={f}
    label="Your file"
    name={:file}
    hint="50 MB max"
    placeholder="A file may take up to 5 minutes to upload."
    upload_config={%Phoenix.LiveView.UploadConfig{accept: ".jpg, .png", ref: "upload-input"}}
    upload_progress={0}
   />
</.phx_form_for>
<.phx_form_for for={%{}} as={:story} :let={f}>
  <.file_upload_input_group
    form={f}
    label="Your file"
    name={:file}
    upload_config={%Phoenix.LiveView.UploadConfig{accept: ".jpg, .png", ref: "upload-input"}}
    upload_progress={50}
   />
</.phx_form_for>

files

<.phx_form_for for={%{}} as={:story} :let={f}>
  <.file_upload_input_group
    form={f}
    name={:file}
    upload_config={%Phoenix.LiveView.UploadConfig{entries: [%Phoenix.LiveView.UploadEntry{ref: "upload-input"}], accept: ".jpg, .png", ref: "upload-input", errors: [{"upload-input", :too_large}]}}
    upload_progress={0}
   />
</.phx_form_for>