The code you pasted as your form code above and the form code on the deployed website is not the same when I inspected the form using Chrome Dev Tools.
However make sure you are deploying the form code above and then set the action attribute of the form to the value "/contact"
action="/contact"
You site also has the error below in the console.
Uncaught TypeError: Cannot read properties of null (reading ‘getElementsByTagName’)
at window.onload
Kindly fix that
Make the suggested edits and then redeploy and let me know the outcome.
Thanks.
I’ve hid it so the users don’t see it as it doesn’t work. To test it, I remove the display none. It won’t affect on not receiving the files.
Please, it has to be something else…
Hi @Paloma
It looks like you don’t have a data-netlify="true" attribute in your form element. Please add this and redeploy to see if the issue is resolved.
Learn more about Netlify forms here:
Hello @Paloma, if you take a look at the image I shared you will realize that what @kylesloper stated is true. Your form does not have data-netlify="true" attribute.
Kindly make sure your deploys are being published to production.
We saw a similar case to this the other week. It appeared that Netlify was stripping the attribute on build. Eventually we realized that OP was deploying from a different codebase to what they were editing.
@Paloma can you confirm this? If you are using a git repo please ensure Netlify is deploying the correct branch and you have pushed all your local commits.
Hi, @Paloma. I see the backend handler created to receive the file field data.
I believe I’ve found the reason and it is covered in this support guide:
Quoting the relevant section below:
Make sure that you POST your form request (not GET) with a Content-Type of application/x-www-form-urlencoded in most cases. However, if and only if you are submitting the form with a file upload then the Content-Type needs to be multipart/form-data instead.
In my testing, the form is using content-type: application/x-www-form-urlencoded for the submission. This is why the files are missing. Would you please change this to use content-type: application/x-www-form-urlencoded instead?
If that doesn’t resolve the missing uploaded file issue (or if there are other questions), please let us know.
@Paloma It seems like you still have the incorrect content type on your form. Luke mentioned that you need to set the content type to multipart/form-data as outlined below:
Can you also confirm if you are using an HTTP POST request to submit the form?
Thank youuu! this finally worked, when I removed the JS. That code was my confirmation page, since I didn’t manage to create it another way. But it’s fine. Thanks again.
So, this may be unrelated in a way, but I just went through a file not being passed through issue and resolved it by removing content type from my fetch. I get the form from the page and validate it on the server, then do a POST fetch to a hidden static route with the form for Netlify. I found that you should not use a content type encoding in fetch POSTs for multipart/form-data. The link below discusses.