We are using a Netlify form on our individual job pages to capture applicant information and upload their resume. I have now been asked to add an upload for an OPTIONAL cover letter. So the form needs to support two uploads.
Can this be done?
I tried this:
Attach Resume *
<input
hidden
id=“attachment”
type=“file”
name=“attachment”
value={field}
onChange={(e) => {
setFileName(e.target.files[0].name);
}}
/>
Attach Cover Letter
{filename && message !== ‘Email sent successfully!’ && (
{filename}
)}
Send
But I cannot upload two files, only 1.
Thanks for your help
NETLIFY SITE NAME: lively-react.netlify.app
luke
March 10, 2021, 1:59am
#2
Hi, @Jennifer_G . There is a topic which discusses this in great detail here:
I can’t find any documentation on file uploads for Netlify forms using fetch for submission.
I am using Formik with yup for validation and need to send a form with a range of fields, including one field with multiple file uploads.
The form is successfully posting to Netlify with all other data using Object.keys, encodeURIComponent and .join("&"). But this won’t work for Files as it needs to send the File object. Any idea how I can send this data along with other fields so that Netlify recognis…
There are some solutions posted there as well. If there are questions after reading that topic, please let us know.