<p>If you want to upload assets with your form, you will need to include <code>enctype="multipart/form-data"</code> in your form tag:
<code>&lt;form method="post" accept-charset="UTF-8" enctype="multipart/form-data" ...</code> </p>

CC BY-SA 3.0
2016-10-27T20:49:44.800Z
2016-10-27T20:49:44.800Z
Wolfram Gehring
<p>I've got <a href="https://github.com/am-impact/amforms" rel="nofollow noreferrer">A&amp;M forms</a> set up and I'm trying to get a assets field to upload files. </p>

<p>My current form code is below. If I remove the first line then the form works correctly but I can't get a file upload to work without it as I am unable to figure out how to manually code the file upload field.</p>

<p>My current commented out code for the file was cribbed from a previous ExpressionEngine install and uses some Javascript to allow styling of the field. Everything seems to work here as I can upload a file but due to the internal server error on submit I can't be sure. </p>

<p>Without line 1 the form works but I can't get file uploads. How do I resolve this?</p>

<pre class="lang-html prettyprint-override"><code>{% set form = craft.amForms.getForm('requestQuote') %}


&lt;form method="post" accept-charset="UTF-8" class="form-horizontal contact-form"&gt;
{# This should always be here! #}
&lt;input type="hidden" name="action" value="amForms/submissions/saveSubmission"&gt;

{# Insert your forms handle. #}
&lt;input type="hidden" name="handle" value="requestQuote"&gt;

{# Optional: Redirect URL. Will redirect to current page by default. #}
&lt;input type="hidden" name="redirect" value="contact/thankyou"&gt;

{# Optional: Anti-spam protection. #}
  {{ craft.amForms.displayAntispam() }}

  {# Optional: Google reCAPTCHA protection. #}
  {{ craft.amForms.displayRecaptcha() }}

  &lt;fieldset class="row"&gt;

    &lt;div class="col-sm-6"&gt;
        &lt;label class="sr-only control-label" for="textinput"&gt;Name&lt;/label&gt;
        &lt;input id="name" name="fields[fullName]" type="text" placeholder="Name" class="form-control input-md" required&gt;

    &lt;/div&gt;

    &lt;div class="col-sm-6"&gt;
        &lt;label class="sr-only control-label" for="Email"&gt;Email&lt;/label&gt;
        &lt;input id="email" name="fields[emailAddress]" type="email" placeholder="Email" class="form-control input-md" required&gt;

    &lt;/div&gt;

    &lt;div class="col-sm-6"&gt;
        &lt;label class="sr-only control-label" for="phone"&gt;Phone&lt;/label&gt;
        &lt;input id="phone" name="fields[telephoneNumber]" type="text" placeholder="Phone" class="form-control input-md"&gt;
    &lt;/div&gt;

    &lt;div class="col-sm-6"&gt;
        &lt;label class="sr-only control-label" for="companyName"&gt;Company Name&lt;/label&gt;
        &lt;input id="company" name="fields[companyName]" type="text" placeholder="Company Name" class="form-control input-md"&gt;
    &lt;/div&gt;

    &lt;div class="col-sm-12"&gt;
      &lt;label class="sr-only control-label" for="budget"&gt;Budget&lt;/label&gt;
        &lt;select id="budget" name="fields[budget]" class="form-control" required&gt;
          &lt;option disabled="" selected&gt;expected budget&lt;/option&gt;
        &lt;option value="&lt; $2,500"&gt;&lt; $2,500&lt;/option&gt;
        &lt;option value="$2,500-$5,000"&gt;$2,500-$5,000&lt;/option&gt;
        &lt;option value="$5,000-$10,000"&gt;$5,000-$10,000&lt;/option&gt;
        &lt;option value="$10,000-$15,000"&gt;$10,000-$15,000&lt;/option&gt;
        &lt;option value="&gt; $15,000"&gt;&gt;$15,000&lt;/option&gt;
        &lt;option value="More Details below"&gt;More Details below&lt;/option&gt;
        &lt;option value="I'm not sure"&gt;I'm not sure&lt;/option&gt;
        &lt;/select&gt;
    &lt;/div&gt;

{#
// commmented out for testing
// unstyled field added below this commented block
    &lt;div class="col-sm-12"&gt;
      &lt;span id="changefree"&gt;{{ form.displayField('attachment') }}&lt;/span&gt;
      &lt;div class="input-group"&gt;
        &lt;input type="text" name="fields[attachment][]" id="fields-attachment" class="form-control" disabled placeholder="Upload File"&gt;
        &lt;span class="input-group-btn"&gt;
          &lt;button class="browse btn btn-default extra-pad" type="button"&gt;&lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt; Browse&lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    #}

    {{ form.displayField('attachment') }}



    &lt;!-- Textarea --&gt;
    &lt;div class="col-sm-12"&gt;
      &lt;label class="sr-only control-label" for="projectDetails"&gt;Project Details and Message&lt;/label&gt;
        &lt;textarea class="form-control" id="project_details" name="fields[projectDetails]" placeholder="Project Details and Message"&gt;&lt;/textarea&gt;
    &lt;/div&gt;

    &lt;!-- Button --&gt;
    &lt;div class="col-sm-12"&gt;
      &lt;button id="singlebutton" type="submit" name="singlebutton" class="btn btn-primary"&gt;Submit&lt;/button&gt;
    &lt;/div&gt;

  &lt;/fieldset&gt;



&lt;/form&gt;
</code></pre>

CC BY-SA 3.0
2016-10-26T20:47:39.203Z
The underlying error message for the 500 Internal Server Error is either going to be logged in `craft/storage/runtime/logs` if Craft generated it, or your web server's error logs if your web server generated it.
Brad Bell
CC BY-SA 3.0
2016-10-26T20:57:58.573Z
The server error log is empty on my host but I'm not sure what to look for in the /logs file for Craft.
CreateSean
CC BY-SA 3.0
2016-10-26T21:15:51.993Z
Nuke the logs, reproduce the issue, then search for `[error]` in the `craft.log` files or in the `phperrors.log` if you have that one, too.
Brad Bell
CC BY-SA 3.0
2016-10-26T22:25:17.117Z
Maybe it helps if you add `enctype="multipart/form-data"`to the form tag? See (https://github.com/am-impact/amforms/issues/64)
Wolfram Gehring
CC BY-SA 3.0
2016-10-27T16:30:11.653Z
@WolframGehring Can you add that as an answer so I can mark it correct. Thanks.
CreateSean
CC BY-SA 3.0
2016-10-27T20:50:19.880Z
@CreateSean Glad it´s working now :)
Wolfram Gehring
<form><error><plugin-amforms>
A&M forms on submit internal server error
# A&M forms on submit internal server error

(Asked by: username_0 on 2016-10-26)

I've got A&M forms set up and I'm trying to get a assets field to upload files. 
My current form code is below. If I remove the first line then the form works correctly but I can't get a file upload to work without it as I am unable to figure out how to manually code the file upload field.
My current commented out code for the file was cribbed from a previous ExpressionEngine install and uses some Javascript to allow styling of the field. Everything seems to work here as I can upload a file but due to the internal server error on submit I can't be sure. 
Without line 1 the form works but I can't get file uploads. How do I resolve this?
{% set form = craft.amForms.getForm('requestQuote') %}



{# This should always be here! #}


{# Insert your forms handle. #}


{# Optional: Redirect URL. Will redirect to current page by default. #}


{# Optional: Anti-spam protection. #}
  {{ craft.amForms.displayAntispam() }}

  {# Optional: Google reCAPTCHA protection. #}
  {{ craft.amForms.displayRecaptcha() }}

  

    
        Name
        

    

    
        Email
        

    

    
        Phone
        
    

    
        Company Name
        
    

    
      Budget
        
          expected budget
        < $2,500
        $2,500-$5,000
        $5,000-$10,000
        $10,000-$15,000
        >$15,000
        More Details below
        I'm not sure
        
    

{#
// commmented out for testing
// unstyled field added below this commented block
    
      {{ form.displayField('attachment') }}
      
        
        
           Browse
        
      
    
    #}

    {{ form.displayField('attachment') }}



    
    
      Project Details and Message
        
    

    
    
      Submit

**Tags:** form, error, plugin-amforms
> **Comments:**
> **username_1**: The underlying error message for the 500 Internal Server Error is either going to be logged in `craft/storage/runtime/logs` if Craft generated it, or your web server's error logs if your web server generated it.  
> **username_0**: The server error log is empty on my host but I'm not sure what to look for in the /logs file for Craft.  
> **username_1**: Nuke the logs, reproduce the issue, then search for `[error]` in the `craft.log` files or in the `phperrors.log` if you have that one, too.  
> **username_2**: Maybe it helps if you add `enctype="multipart/form-data"`to the form tag? See (https://github.com/am-impact/amforms/issues/64)  
> **username_0**: @WolframGehring Can you add that as an answer so I can mark it correct. Thanks.  
> **username_2**: @CreateSean Glad it´s working now :)  

---

## 1 answers

### Answer by username_2 on 2016-10-27. Score: 3 | Accepted answer

If you want to upload assets with your form, you will need to include `enctype="multipart/form-data"` in your form tag:


---

