Forum

Thread tagged as: Forms

Problems with input type="file" in Forms app

I'm setting up a form that requires a number of file uploads. Everything in the form seems to be working fine except for the type="file".

Can't get anything to submit to the forms area or even get the ID to show up.

My form is pretty long so I grabbed the perch sample form and stripped it down to try and figure it out without any luck.

My code:

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

    <perch:content id="intro" type="textarea" label="Intro" textile="true" editor="markitup" size="m" />

    <div>
        <perch:label for="name">Name</perch:label>
        <perch:input type="text" id="name" required="true" label="Name" />      
    </div>

    <perch:input type="file" id="cv" accept="pdf doc" label="File" />

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

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

Thoughts?

Nathan Rothenberger

Nathan Rothenberger 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are pdf and doc defined as types in your filetypes.ini file? Normally that would be something like office

My bad, that should have read as follows.

<perch:input type="file" id="cv" accept="pdf text richtext office" label="File" />

I have tried it with only `accept="pdf" and still see nothing in my form app showing that field.

Also worth noting that I have not altered the filetypes.ini file at all.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you remove the accept attribute completely, does that make a difference?

It does not.

Nothing with type="file"

is showing up in the forms app.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How big is the file, and what's your upload limit?

I don't know what the upload limit is. I'm just running it off a local MAMP server.

Files I've test range from 500K to 4MB.

The ID is just not even showing up in the backend. It seems like I'm formatting something wrong or missing some tag? I don't know, all my other form fields seem to show up fine.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does the file get uploaded into the site?

Where are forms stored in the file structure?

I don't see it, but I don't see any of the form responses/know where to look for them in the files.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You set the storage location in the form options. Have you done that? If not, that could explain the problem.

Drew, that did solve the problem.

For clarity sake, I have to submit the first form before I can set those options right?

Example: I have a new form, FORM FOO that uses a file type. To set the file storage location I must submit the FORM FOO once to get it to show up in the forms app. From there I can set the storage location for that form?

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that's right.