Upload an Image
Quickly upload an image.
<%# Multipart, remote forms are tricky, the data is actually sent in the Stimulus controller. %>
<%= form_with(url: image_uploads_path, multipart: true) do |f| %>
<%= label_tag :image, "Image:", class: "crayons-field__label" %>
<%= f.file_field :image, required: true, accept: "image/*", data: { "image-upload-target": "fileField" } %>
<%= f.submit "Upload", class: "crayons-btn mt-4", data: { action: "image-upload#onFormSubmit" } %>
<% end %>