Answers.Body: <p>Figured out what my problem was: I was trying to submit the form via Ajax, that's why the submit button is set to input type="button" 
  I changed the submit button to input type="submit" &amp; it worked.
  Not 100% sure how to make it work with Ajax but pretty sure it has something to do with the way the data is serialized. I don't really need Ajax submission in this instance, so not bothering with it anymore. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-19T09:14:50.627Z
Answers.LastActivityDate: 2017-07-19T09:14:50.627Z
Answers.UserDisplayName: celeste.nexus
Body: <p>I'm trying to add an file upload/attachment to my Sprout Form submission, but even though all the other fields are saved &amp; the Sprout Email notification is sent - the file field remains empty - no file is uploaded &amp; so no attachment is sent. </p>
  
  <ul>
  <li>I've checked that my form contains enctype="multipart/form-data" </li>
  <li>I've checked that the file type I'm trying to upload is an allowed file
  type for the Asset folder ie: PDF </li>
  <li>I've checked that the file is a reasonable size - in this case 3KB </li>
  <li>I've checked the craft log, sprout forms log &amp; sprout email log &amp; there are no errors.</li>
  </ul>
  
  <p>Anyone have any ideas ? Below is my form code - what am I missing ? </p>
  
  <pre><code>&lt;form id="careerApplication" method="post" action="" accept-charset="UTF-8" 
  enctype="multipart/form-data"&gt;
  {{ getCsrfInput() }}
  &lt;input type="hidden" name="action" value="sproutForms/entries/saveEntry"&gt;
  &lt;input type="hidden" name="handle" value="careerApplication"&gt;      
  &lt;fieldset&gt;
      {{ craft.sproutForms.displayField('careerApplication.fullName') }}
  &lt;/fieldset&gt;
  &lt;fieldset&gt;
      &lt;label for="fields[refNo]"&gt;Reference #&lt;/label&gt;
      &lt;input type="text" name="fields[refNo]" id="fields-refNo" readonly value="{{ craft.request.getParam('ref') }}" /&gt;
  &lt;/fieldset&gt;
  &lt;fieldset&gt;
      {{ craft.sproutForms.displayField('careerApplication.email') }}
  &lt;/fieldset&gt;
  &lt;fieldset&gt;
      {{ craft.sproutForms.displayField('careerApplication.telephone') }}
  &lt;/fieldset&gt; 
  &lt;fieldset&gt;         
      &lt;label for="motivation"&gt;Motivation&lt;/label&gt;
      &lt;textarea name="fields[motivation]" id="fields-motivation" placeholder="Motivation"&gt;&lt;/textarea&gt;
  &lt;/fieldset&gt; 
  &lt;fieldset&gt;
      &lt;label for="cvUpload"&gt;Submit your CV:&lt;/label&gt;
      &lt;input type="file" name="fields[cvUpload]" id="fields-cvUpload" /&gt;    
  &lt;/fieldset&gt;                   
  {{ craft.sproutInvisibleCaptcha.protect() }}
  &lt;input id="submit_application" name="submit_application" type="button" value="Submit Application" class="red-btn" /&gt;
  &lt;/form&gt; 
  </code></pre>
  
Tags: <plugin-sproutforms><plugin-sproutemail><files>
Title: Cannot get file upload/attachment with Sprout Forms working
ThreadText: # Cannot get file upload/attachment with Sprout Forms working
  
  (Asked by: username_0 on 2017-07-18)
  
  I'm trying to add an file upload/attachment to my Sprout Form submission, but even though all the other fields are saved & the Sprout Email notification is sent - the file field remains empty - no file is uploaded & so no attachment is sent.
  
  * I've checked that my form contains enctype="multipart/form-data"
  * I've checked that the file type I'm trying to upload is an allowed file
    type for the Asset folder ie: PDF
  * I've checked that the file is a reasonable size - in this case 3KB
  * I've checked the craft log, sprout forms log & sprout email log & there are no errors.
  
  Anyone have any ideas ? Below is my form code - what am I missing ?
  
  ```
  <form id="careerApplication" method="post" action="" accept-charset="UTF-8" 
  enctype="multipart/form-data">
  {{ getCsrfInput() }}
  <input type="hidden" name="action" value="sproutForms/entries/saveEntry">
  <input type="hidden" name="handle" value="careerApplication">      
  <fieldset>
      {{ craft.sproutForms.displayField('careerApplication.fullName') }}
  </fieldset>
  <fieldset>
      <label for="fields[refNo]">Reference #</label>
      <input type="text" name="fields[refNo]" id="fields-refNo" readonly value="{{ craft.request.getParam('ref') }}" />
  </fieldset>
  <fieldset>
      {{ craft.sproutForms.displayField('careerApplication.email') }}
  </fieldset>
  <fieldset>
      {{ craft.sproutForms.displayField('careerApplication.telephone') }}
  </fieldset> 
  <fieldset>         
      <label for="motivation">Motivation</label>
      <textarea name="fields[motivation]" id="fields-motivation" placeholder="Motivation"></textarea>
  </fieldset> 
  <fieldset>
      <label for="cvUpload">Submit your CV:</label>
      <input type="file" name="fields[cvUpload]" id="fields-cvUpload" />    
  </fieldset>                   
  {{ craft.sproutInvisibleCaptcha.protect() }}
  <input id="submit_application" name="submit_application" type="button" value="Submit Application" class="red-btn" />
  </form> 
  
  ```
  
  **Tags:** plugin-sproutforms, plugin-sproutemail, files
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-07-19. Score: 2
  
  Figured out what my problem was: I was trying to submit the form via Ajax, that's why the submit button is set to input type="button"
  I changed the submit button to input type="submit" & it worked.
  Not 100% sure how to make it work with Ajax but pretty sure it has something to do with the way the data is serialized. I don't really need Ajax submission in this instance, so not bothering with it anymore.
  
  
  ---
  
  