We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Problem, Error

Form with file upload

Hi...

I'm having an issue with the file upload on the form, and I can't for the life of me work out what i've done wrong. The form submits fine if you don't attached a document, and I've try different documents and types. If you attached a doc the page just refreshes as if theres an error in a field, the files input goes back to blank but the others remain.

In the admin I'm not getting any issues with the form path... folder is 777. There's no alerts in the Diagnostics

Template code

<perch:form id="vacancies" method="post" app="perch_forms">

        <perch:input type="text" id="name" required="true" label="Name" placeholder="Full Name" class="name" />
        <perch:input type="text" id="number" required="true" label="Number" placeholder="Contact Number" class="tel" />
        <perch:input type="email" id="email" required="true" label="Email" placeholder="Email Address" class="email" />
        <perch:input type="textarea" id="coverletter" required="true" label="Cover Letter..." placeholder="Cover letter..." />
        <perch:input type="file" id="cv" required="false" placeholder="Attached C.V  (.doc, docx or pdf) " accept="doc docx rtf pdf" />


            <perch:error for="name" type="required"><div class="error">Please add your name</div></perch:error>
            <perch:error for="number" type="required"><div class="error">Please add your number</div></perch:error>
            <perch:error for="email" type="required"><div class="error">Please add your email address</div></perch:error>
            <perch:error for="email" type="format"><div class="error">Please check your email address</div></perch:error>
            <perch:error for="coverletter" type="required"><div class="error">Please add a Cover Letter</div></perch:error>

        <perch:input type="submit" id="submit" value="Send Application" />


        <perch:success>
            <perch:content id="success" type="textarea" label="Thank you message" textile="true" editor="markitup" />
        </perch:success>

    </perch:form>

Can any one see what i've done wrong?

Thanks

Stephen Wild

Stephen Wild 3 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostics report?

You have:

accept="doc docx rtf pdf"

Are those types defined as groups in your config/filetypes.ini file?

As far as i can see they are...

[webimage]
image/gif
image/jpeg
image/jpg
image/png
image/svg+xml
image/webp

[image]
image/*

[pdf] 
application/pdf

[text]
application/plain
text/plain

[richtext]
application/rtf
application/x-rtf
text/richtext
text/rtf

[xml]
application/x-latex
application/xml
text/xml

[zip]
application/rar
application/x-bzip
application/x-bzip2
application/x-compressed
application/x-gzip
application/x-rar
application/x-rar-compressed
application/x-sit
application/x-stuffit
application/x-zip
application/x-zip-compressed
application/zip
multipart/x-gzip
multipart/x-zip
application/gnutar

[audio]
application/x-midi
audio/*

[video]
application/x-troff-msvideo
video/*

[flash]
application/x-shockwave-flash

[office] 
application/arj
application/excel
application/mspowerpoint
application/msword
application/onenote
application/powerpoint
application/vnd.ms-excel
application/vnd.ms-excel.addin.macroEnabled.12
application/vnd.ms-excel.sheet.binary.macroEnabled.12
application/vnd.ms-excel.sheet.macroEnabled.12
application/vnd.ms-excel.template.macroEnabled.12
application/vnd.ms-office
application/vnd.ms-officetheme
application/vnd.ms-powerpoint
application/vnd.ms-powerpoint.addin.macroEnabled.12
application/vnd.ms-powerpoint.presentation.macroEnabled.12
application/vnd.ms-powerpoint.slide.macroEnabled.12
application/vnd.ms-powerpoint.slideshow.macroEnabled.12
application/vnd.ms-powerpoint.template.macroEnabled.12
application/vnd.ms-word
application/vnd.ms-word.document.macroEnabled.12
application/vnd.ms-word.template.macroEnabled.12
application/vnd.oasis.opendocument.chart
application/vnd.oasis.opendocument.database
application/vnd.oasis.opendocument.formula
application/vnd.oasis.opendocument.graphics
application/vnd.oasis.opendocument.graphics-template
application/vnd.oasis.opendocument.image
application/vnd.oasis.opendocument.presentation
application/vnd.oasis.opendocument.presentation-template
application/vnd.oasis.opendocument.spreadsheet
application/vnd.oasis.opendocument.spreadsheet-template
application/vnd.oasis.opendocument.text
application/vnd.oasis.opendocument.text-master
application/vnd.oasis.opendocument.text-template
application/vnd.oasis.opendocument.text-web
application/vnd.openofficeorg.extension
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/vnd.openxmlformats-officedocument.presentationml.slide
application/vnd.openxmlformats-officedocument.presentationml.slideshow
application/vnd.openxmlformats-officedocument.presentationml.template
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.openxmlformats-officedocument.spreadsheetml.template
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.openxmlformats-officedocument.wordprocessingml.template
application/wordperfect
application/x-excel
application/x-msexcel
application/doc
application/docx
Drew McLellan

Drew McLellan 2638 points
Perch Support

I see pdf but not the others.

Which type of file are you trying to upload?

I think you probably want

accept="office pdf"

Perfect!

I'm an idiot, not done one of these since perch 1 and dint realise that accept= " " was for the group headings not the file extensions