# Cannot submit multiple images

**URL:** <https://answers.netlify.com/t/cannot-submit-multiple-images/41138>\
**Category:** Support\
**Tags:** netlify-forms\
**Created:** [July 17, 2021, 11:11pm UTC](https://answers.netlify.com/t/cannot-submit-multiple-images/41138 "2021-07-17T23:11:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eberkund](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/eberkund/32/27660_2.png) [@eberkund](https://answers.netlify.com/u/eberkund)\
**Post date:** [July 17, 2021, 11:11pm UTC](https://answers.netlify.com/t/cannot-submit-multiple-images/41138/1 "2021-07-17T23:11:24Z")

</div>

I am trying to build a contact form with Netlify Forms (and Alpine JS) but the file upload part is not working. In the Netlify backend I have it setup for forward the messages from this form submission to an email address but none of the images make it through. I have verified with Chrome developer tools that the images are being posted to the server.

Originally I had a tried using `name="photos[]"` but I saw another message that this was not supported so I switched it use different names for each image `name="photo1"`, `name="photo2"`, etc.

```nohighlight
<form name="contact" action="/" method="POST" enctype="multipart/form-data" netlify>
    <div class="col-md-6 col-sm-12">
        <div class="block">
            <div class="form-group">
                <input name="name" type="text" class="form-control" placeholder="Your Name" required>
            </div>
            <div class="form-group">
                <input name="email" type="text" class="form-control" placeholder="Email Address" required>
            </div>
            <div class="form-group">
                <input name="size" type="text" class="form-control" placeholder="Square feet" required>
            </div>
            <div class="form-group">
                <input name="phone" type="text" class="form-control" placeholder="Phone" required>
            </div>
            <div class="form-group">
                <select name="category" class="form-control">
                    <option disabled selected>Category</option>
                    <option>Landscaping</option>
                    <option>Hardscaping</option>
                    <option>Cleaning</option>
                    <option>Sealing & Coatings</option>
                </select>
            </div>
            <div x-data="{ count: 1 }">
                <template x-for="i in count">
                    <div class="form-group">
                        <input type="file" :name="'photo' + i">
                    </div>
                </template>
                <div class="form-group">
                    <button type="button" class="btn btn-main" @click="count++">Add photo</button>
                    <p class="help-block">Upload a picture of your project.</p>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-6 col-sm-12">
        <div class="block">
            <div class="form-group">
                <textarea name="job_address" class="form-control" placeholder="Your address" required></textarea>
            </div>
            <div class="form-group">
                <textarea name="user_message" class="form-control" placeholder="What would you like done?" required></textarea>
            </div>
            <div class="form-group block">
                <button type="submit" class="btn btn-main">{{ i18n "submit" }}</button>
            </div>
            <div class="form-group">
                <div netlify-recaptcha></div>
            </div>
        </div>
    </div>
</form>

```

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [July 17, 2021, 11:32pm UTC](https://answers.netlify.com/t/cannot-submit-multiple-images/41138/2 "2021-07-17T23:32:24Z")

</div>

Hi @eberkund

It appears you are adding a photo by clicking a button, then clicking the button again to add another. Is that correct?

If so, this is not possible. Forms are processed at build time and the fields that are present then are the fields that are submitted. If you wish to allowing uploading multiple files, you would need to have these fields present.

---

<div class="post-metadata">

**Author:** ![eberkund](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/eberkund/32/27660_2.png) [@eberkund](https://answers.netlify.com/u/eberkund)\
**Post date:** [July 18, 2021, 4:34am UTC](https://answers.netlify.com/t/cannot-submit-multiple-images/41138/3 "2021-07-18T04:34:28Z")

</div>

I see, that is correct.

Then how does it works for AJAX submitted forms? Do they also need to be present as static HTML at build time?

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [July 18, 2021, 5:00am UTC](https://answers.netlify.com/t/cannot-submit-multiple-images/41138/4 "2021-07-18T05:00:54Z")

</div>

> [@eberkund](#):
>
> Then how does it works for AJAX submitted forms? Do they also need to be present as static HTML at build time?

AJAX is only submitting the form (not creating it), so yes, the static form must/will already exist on the site.

If you are rendering a form in JavaScript there is a [method for that](https://docs.netlify.com/forms/setup/#javascript-forms) too.

In either case, there is no way to append elements to the form (like adding extra images—see [Append external data to the form in React](https://answers.netlify.com/t/append-external-data-to-the-form-in-react/40969))

If wanting to give people the option to add more fields, you could add multiple hidden fields to the form and use a button to unhide them, look at submitting using a serverless function (keeping in mind that they have a 10 second execution limit) or use a third-party service.

---

<div class="post-metadata">

**Author:** ![tomrutgers](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/tomrutgers/32/107_2.png) [@tomrutgers](https://answers.netlify.com/u/tomrutgers)\
**Post date:** [July 18, 2021, 3:40pm UTC](https://answers.netlify.com/t/cannot-submit-multiple-images/41138/5 "2021-07-18T15:40:36Z")

</div>

This discussion might be valuable:

> [@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…
