File Upload

Scripting Custom Views Form Helpers

The upload_tag helper tag generates a file upload field.

  • name: The input's name attribute.
  • multiple: Whether or not to allow multiple files. By default this will be false.
  • label: Adds label text above the upload field.
  • id: The input's ID attribute. By default this will be set to the name, converted into a variable_name-style string.
Helper Tag
{% upload_tag name: "name", label: "Upload field label!", id: "id", multiple: true %}
HTML Output
<label class="d-block">Text field label!</label>
<label class="custom-file">
  <input type="file" class="custom-file-input" multiple="multiple" name="name" id="id">
  <span class="custom-file-control"></span>
</label>