Programming Phoenix LiveView: Display Image Uploads (pdf p142)

One more point regarding the image upload: you referenced the function upload_image_error/2 on page 144 but it was never declared anywhere:

<p>entries</p>
<%= for entry <- @uploads.image.entries do %>
<p>
<%= entry.client_name %> - <%= entry.progress %>%
<span class="alert-danger"><%= upload_image_error(@uploads, entry)%></span>
<button phx-target="{ @myself }"
phx-click="cancel-upload" phx-value-ref="{ entry.ref }">cancel</button> </p>
<% end %>

Sure, when I grabbed the source code, I found the function but it looks a bit weird to not mention it at all (at list smth like an exercise to do, etc.).

2 Likes