Forum

Thread tagged as: Question, Configuration, Forms

upload a file using type="file"

I have a contact form, and want visitors to be able to upload an attached file.

I see this in the Perch Documentaton:

Remember if using file inputs with the Forms app, you need to configure a file upload location within the form options.

I'm also aware of the recommendation to upload the file above the root folder.

My problem: I'm a blockhead, and I don't know how to do that.

Here's the type="file" part- the rest of the form is a contact form that works fine:

<perch:form id="contact" method="post" app="perch_forms" role="form">
         <div>
                   <perch:label for="sendfile">Send us a file</perch:label>
                   <perch:input type="file" id="sendfile" label="file" accept="pdf doc docx xls xlsx" />
         </div>
</perch:form>
John Rose

John Rose 6 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is your site in a folder something like public_html ? Can you create an uploads folder outside of that?

This is a development site, trying to work out my last glitch before moving it to staging.

Is there a way to define a path locally to assure myself of doing it correctly and then re-define that later?

I guess it come down to: I don't know what that bit of code looks like, or should look like eventually.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes. Whatever folder your site is in, make a new one outside of it and use that for your uploads.

That's all it is - really simple - just make a folder you can upload to that isn't directly part of your website.

Should anyone have this same difficulty:

Ahah! So easy...

Set at Forms -> Choose Form -> Form Options -> Check "store responses" and fill in "File upload path".

Don't be like me, trying to somehow set it in the <input type="file"> template.

Sorry to bug Drew, and wishing him fewer bugs in his future.