<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>

CC BY-SA 3.0
2017-07-19T09:14:50.627Z
2017-07-19T09:14:50.627Z
celeste.nexus
<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>

<plugin-sproutforms><plugin-sproutemail><files>
Cannot get file upload/attachment with Sprout Forms working
# 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 ? 

{{ getCsrfInput() }}

      

    {{ craft.sproutForms.displayField('careerApplication.fullName') }}


    Reference #
    


    {{ craft.sproutForms.displayField('careerApplication.email') }}


    {{ craft.sproutForms.displayField('careerApplication.telephone') }}
 
         
    Motivation
    
 

    Submit your CV:
        
                   
{{ craft.sproutInvisibleCaptcha.protect() }}

**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.


---

