Phoenix.LiveView.Helpers.upload_errors
You're seeing just the function
upload_errors
, go back to Phoenix.LiveView.Helpers module for more information.
Returns the entry errors for an upload.
The following errors may be returned:
:too_many_files
- The number of selected files exceeds the:max_entries
constraint
Examples
def error_to_string(:too_many_files), do: "You have selected too many files"
<%= for err <- upload_errors(@uploads.avatar) do %>
<div class="alert alert-danger">
<%= error_to_string(err) %>
</div>
<% end %>
Returns the entry errors for an upload.
The following errors may be returned:
:too_large
- The entry exceeds the:max_file_size
constraint:not_accepted
- The entry does not match the:accept
MIME types
Examples
def error_to_string(:too_large), do: "Too large"
def error_to_string(:not_accepted), do: "You have selected an unacceptable file type"
<%= for entry <- @uploads.avatar.entries do %>
<%= for err <- upload_errors(@uploads.avatar, entry) do %>
<div class="alert alert-danger">
<%= error_to_string(err) %>
</div>
<% end %>
<% end %>