Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-27T20:49:44.800Z
Answers.LastActivityDate: 2016-10-27T20:49:44.800Z
Answers.UserDisplayName: Wolfram Gehring
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-26T20:47:39.203Z
Comments.Text: 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.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-26T20:57:58.573Z
Comments.Text: The server error log is empty on my host but I'm not sure what to look for in the /logs file for Craft.
Comments.UserDisplayName: CreateSean
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-26T21:15:51.993Z
Comments.Text: 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.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-26T22:25:17.117Z
Comments.Text: Maybe it helps if you add `enctype="multipart/form-data"`to the form tag? See (https://github.com/am-impact/amforms/issues/64)
Comments.UserDisplayName: Wolfram Gehring
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-27T16:30:11.653Z
Comments.Text: @WolframGehring Can you add that as an answer so I can mark it correct. Thanks.
Comments.UserDisplayName: CreateSean
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-10-27T20:50:19.880Z
Comments.Text: @CreateSean Glad it´s working now :)
Comments.UserDisplayName: Wolfram Gehring
Tags: <form><error><plugin-amforms>
Title: A&M forms on submit internal server error
ThreadText: # A&M forms on submit internal server error
  
  (Asked by: username_0 on 2016-10-26)
  
  I've got [A&M forms](https://github.com/am-impact/amforms) 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?
  
  ```html
  {% set form = craft.amForms.getForm('requestQuote') %}
  
  <form method="post" accept-charset="UTF-8" class="form-horizontal contact-form">
  {# This should always be here! #}
  <input type="hidden" name="action" value="amForms/submissions/saveSubmission">
  
  {# Insert your forms handle. #}
  <input type="hidden" name="handle" value="requestQuote">
  
  {# Optional: Redirect URL. Will redirect to current page by default. #}
  <input type="hidden" name="redirect" value="contact/thankyou">
  
  {# Optional: Anti-spam protection. #}
    {{ craft.amForms.displayAntispam() }}
  
    {# Optional: Google reCAPTCHA protection. #}
    {{ craft.amForms.displayRecaptcha() }}
  
    <fieldset class="row">
  
      <div class="col-sm-6">
          <label class="sr-only control-label" for="textinput">Name</label>
          <input id="name" name="fields[fullName]" type="text" placeholder="Name" class="form-control input-md" required>
  
      </div>
  
      <div class="col-sm-6">
          <label class="sr-only control-label" for="Email">Email</label>
          <input id="email" name="fields[emailAddress]" type="email" placeholder="Email" class="form-control input-md" required>
  
      </div>
  
      <div class="col-sm-6">
          <label class="sr-only control-label" for="phone">Phone</label>
          <input id="phone" name="fields[telephoneNumber]" type="text" placeholder="Phone" class="form-control input-md">
      </div>
  
      <div class="col-sm-6">
          <label class="sr-only control-label" for="companyName">Company Name</label>
          <input id="company" name="fields[companyName]" type="text" placeholder="Company Name" class="form-control input-md">
      </div>
  
      <div class="col-sm-12">
        <label class="sr-only control-label" for="budget">Budget</label>
          <select id="budget" name="fields[budget]" class="form-control" required>
            <option disabled="" selected>expected budget</option>
          <option value="< $2,500">< $2,500</option>
          <option value="$2,500-$5,000">$2,500-$5,000</option>
          <option value="$5,000-$10,000">$5,000-$10,000</option>
          <option value="$10,000-$15,000">$10,000-$15,000</option>
          <option value="> $15,000">>$15,000</option>
          <option value="More Details below">More Details below</option>
          <option value="I'm not sure">I'm not sure</option>
          </select>
      </div>
  
  {#
  // commmented out for testing
  // unstyled field added below this commented block
      <div class="col-sm-12">
        <span id="changefree">{{ form.displayField('attachment') }}</span>
        <div class="input-group">
          <input type="text" name="fields[attachment][]" id="fields-attachment" class="form-control" disabled placeholder="Upload File">
          <span class="input-group-btn">
            <button class="browse btn btn-default extra-pad" type="button"><i class="glyphicon glyphicon-search"></i> Browse</button>
          </span>
        </div>
      </div>
      #}
  
      {{ form.displayField('attachment') }}
  
      <!-- Textarea -->
      <div class="col-sm-12">
        <label class="sr-only control-label" for="projectDetails">Project Details and Message</label>
          <textarea class="form-control" id="project_details" name="fields[projectDetails]" placeholder="Project Details and Message"></textarea>
      </div>
  
      <!-- Button -->
      <div class="col-sm-12">
        <button id="singlebutton" type="submit" name="singlebutton" class="btn btn-primary">Submit</button>
      </div>
  
    </fieldset>
  
  </form>
  
  ```
  
  **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**: @username_2 Can you add that as an answer so I can mark it correct. Thanks.  
  > **username_2**: @username_0 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:
  `<form method="post" accept-charset="UTF-8" enctype="multipart/form-data" ...`
  
  
  ---
  
  