0

When manually creating a freeform form, I have a series of file upload options which I'm creating as follows:

{exp:freeform:form form:id="freeform" template="career_applications" return="" collection="career_applications" file_upload="Careers" allowed_file_types="pdf|doc|docx|rtf|txt" notify=""}
<input type="hidden" value="{title}" name="job_title" />
<fieldset class="careers-application">
                    <legend class="hide">Apply for this job</legend>
                    <div>
                        <label for="textApplicantFullName">Full name:<span class="mandatory">*</span></label>
                        <input type="text" id="textApplicantFullName" name="name" class="input-text" required />
                        <label for="textApplicantEmailAddress">Email address:<span class="mandatory">*</span></label>
                        <input type="text" id="textApplicantEmailAddress" name="email" class="input-text" required />
                        <label for="fileApplicantCV">Attach CV:<span class="mandatory">*</span></label>
                        <input type="file" id="fileApplicantCV" name="file1" class="input-file" required />
                        <label for="fileApplicantCoverLetter">Cover letter:<span class="mandatory">*</span></label>
                        <input type="file" id="fileApplicantCoverLetter" name="file2" class="input-file" required />
                        <p><strong>Closing date:</strong> <span class="text-orange">{expiration_date format="%j %F %Y"}</span></p>
                        <div class="shadow top"></div>
                        <div class="shadow base"></div>
                    </div>
                    <div>
                        <button class="button green" type="submit">
                            Apply for this job now <i class="icon"></i>
                        </button>
                    </div>
                </fieldset>
{/exp:freeform:form}

the problem appears that the files aren't being uploaded, but the form is still being processed with no errors.

Checking the folder location permissions, path is correct, XSS filtering disabled, spellings etc all to no avail.

4

The problem lies in that you can upload multiple files using FreeForms File Upload Field Type - so you can't just use name="file1" as your field name.

To make this work, you have to pass the field type as a post array, so name="file[0]" for the first file (and if you have multiple files name="file[1]", name="file[2]" and so on.

So, the resolution (for me at least), was to simply append [0] at the end of the field name. It's taken me a couple of hours to figure this out, hence why I'm writing it up here so that anyone else who comes across this problem, gets it resolved relatively quickly.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.