# Uploading file via form to netlify function

**URL:** <https://answers.netlify.com/t/uploading-file-via-form-to-netlify-function/35983>\
**Category:** Support\
**Tags:** lambda-functions\
**Created:** [April 14, 2021, 3:06pm UTC](https://answers.netlify.com/t/uploading-file-via-form-to-netlify-function/35983 "2021-04-14T15:06:32Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [April 14, 2021, 6:13pm UTC](https://answers.netlify.com/t/uploading-file-via-form-to-netlify-function/35983/2 "2021-04-14T18:13:48Z")

</div>

hi there, did you see these posts already? there are very likely some ideas in there for you!

> [@How to send File uploads using fetch via Netlify forms?](https://answers.netlify.com/t/how-to-send-file-uploads-using-fetch-via-netlify-forms/1498):
>
> 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…

> [@Is it possible to have a user upload multiple files in the same form, and how can I attribute meaning to a file upload?](https://answers.netlify.com/t/is-it-possible-to-have-a-user-upload-multiple-files-in-the-same-form-and-how-can-i-attribute-meaning-to-a-file-upload/13488):
>
> Hi there, Currently I am working on a site and am doing a spike around the form integration. The situation is that we wish a user to be able to submit regular form information: e.g Name, email and then upload two images that are of two categories, imagine ‘Cats’ and ‘Dogs’ (not as straight forward as that) and then the user would upload a picture of one or both and then the maintainer of the site would receive an email with all of this information and a link to the stored location of both the i…

> [@Functions - Failed to upload file](https://answers.netlify.com/t/functions-failed-to-upload-file/2088):
>
> Hi, I’m having some issues deploying Netlify functions through the CI. Here is the error I’m getting: Failed to upload file: &{Name:health Sum:c3f2203387ca2e24ec3d20d8c27359ee1b8e49e2787bba658975267c978ae874 Runtime:js Size:\<nil\> Path: Buffer:0xc0001f6330} Full end of log: 12:34:14 AM: Function Dir: /opt/build/repo/functions/dist 12:34:14 AM: TempDir: /tmp/zisi-857404437 12:34:15 AM: Prepping functions with zip-it-and-ship-it 0.3.1 12:34:34 AM: [ { path: '/tmp/zisi-857404437/health.zip', runt…

> [@Example of Netlify Forms with file upload using React, Hooks, Fetch, react-dropzone](https://answers.netlify.com/t/example-of-netlify-forms-with-file-upload-using-react-hooks-fetch-react-dropzone/2770):
>
> Hi! I just wanted to share a simple example of doing a form submission using Netlify Forms with a file upload in React. I’m using [react-dropzone](https://github.com/react-dropzone/react-dropzone), but you can use a regular file input in its place. State is managed using useState hooks and submission is handled with fetch. Demo: [https://demo-react-netlify-form-file.netlify.com/](https://demo-react-netlify-form-file.netlify.com/) Repo: [GitHub - futuregerald/react-netlify-form-file](https://github.com/futuregerald/react-netlify-form-file) Let me know if you have any questions!

> [@Serializing form data: text and file uploads](https://answers.netlify.com/t/serializing-form-data-text-and-file-uploads/7324):
>
> Hello. A have problem with form. When i send my form via fetch or AJAX, on server doesn’t download attached file. This code doesn’ work: let testForm = document.querySelector(".project\_\_form"); testForm.addEventListener('submit', e =\> { e.preventDefault(); const formData = new FormData(testForm); fetch(testForm.getAttribute('action'), { method: 'POST', headers: { 'Accept': 'application/x-www-form-urlencoded;charset=U…

> [@Functions files upload constantly failing](https://answers.netlify.com/t/functions-files-upload-constantly-failing/13439):
>
> Hello! I need advice to debug deploy [Netlify App](https://app.netlify.com/sites/jschat/deploys/5ea72d81be844e846750759d) for my jsCHAT (ReactJS, Netlify Lambda, MongoDB chat app) Everything is going good, but deployment fails when it comes to uploading files - it hangs for few minutes and then shows me message “failed to upload file: ” with every function file. I tried also to re-deploy my old code, but also unsuccessfully. Tried on Xenial and Trusty images.

---

_[View the full topic](https://answers.netlify.com/t/uploading-file-via-form-to-netlify-function/35983)._
