I have a simple form with a file upload field in built with the latest version of Craft 3 and Freeform and I haven't been able to get the file upload to the field to work. When you submit the form with all fields completed and a file selected, you get a submission error saying "Error! Please review the form and try submitting again". Here is my template code, any idea what's wrong?

{# -- Freeform Form --#}
{% set form = craft.freeform.form("contact") %}

{{ form.renderTag({returnUrl: "/contact/thanks"}) }}    

{% if form.hasErrors %}
    <div class="freeform-form-has-errors">
        <strong style="color:red;">{{ "Error! Please review the form and try submitting again."|t('freeform') }}</strong>
{% endif %}

{% set fullName = form.get("fullName") %}
{% set emailAddress = form.get("emailAddress") %}
{% set phone = form.get("phone") %}
{% set resume = form.get("resume") %}

    <input type="text" name="{{ fullName.handle }}" id="{{ fullName.value }}" placeholder="Full Name*" autocomplete="off" class="text"/>
    <i style="color:red;">{{ fullName.renderErrors() }}</i>

    <input type="email" name="{{ emailAddress.handle }}" id="{{ emailAddress.handle }}" placeholder="Email Address*" autocomplete="off" class="text">
    <i style="color:red;">{{ form.get("emailAddress").renderErrors() }}</i>

    <input type="text" name="{{ phone.handle }}" id="{{ phone.handle }}" placeholder="Phone" autocomplete="off" class="text">

    {% if form.get("phone").hasErrors %}<i style="color:red;">This field is required!</i>{% endif %}

<div class="heading">
    <label class="required" for="resume">Attachment</label>

    <label for="resume" class="leave"><i class="fa fa-paperclip" aria-hidden="true"></i> Attach Resume *</label>
    <input type="file" class="form-control-file" name="resume[]" id="resume"/>

<p class="required-wrap">
    <em class="required">* Required</em>
    <button type="submit" class="button">Send</button>
{{ form.renderClosingTag }}

{# -- End Freeform Form --#}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.