# 'Upload Fails' error when using form templates

**URL:** https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110
**Category:** Bug
**Tags:** form-templates
**Created:** [October 19, 2023, 10:56pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110 "2023-10-19T22:56:20Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![gormus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gormus/32/428592_2.png) [@gormus](https://meta.discourse.org/u/gormus)
#### Post date: [October 19, 2023, 10:56pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/1 "2023-10-19T22:56:20Z")

</div>

This is my new favorite feature, thank you! 😃 I’ll be testing out and will report any issues I may come up with; here is the first one:

I’m trying a simple form with an upload field, but the uploads field just errors:

> Sorry, there was an error uploading my-image-1.jpg. Please try again.

My upload field:

```yaml
- type: upload
  id: screenshots
  attributes:
    file_types: ".jpg, .png, .gif"
    allow_multiple: true
    label: "Screenshots"
    description: "If applicable, add screenshots to help explain your issue."

```

1. I fill out the form for all required fields, including the composer Title field.
2. Click on the “Upload” button, select a valid image file.
3. Upload fails, and modal shows up to display the error.

I also checked the settings; the `jpg` file extension is in the authorized extensions list.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [October 23, 2023, 1:42pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/2 "2023-10-23T13:42:24Z")

</div>

I’m seeing this warning when I upload from my iPhone, though the upload does actually go through. On desktop it behaves fine (windows/firefox).

Which browser/device are you using?

* * *

Actually, I may have been too hasty as I don’t think I’m seeing the same warning. Let me have another look. 👀

---

<div class="post-metadata">

### Author: ![gormus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gormus/32/428592_2.png) [@gormus](https://meta.discourse.org/u/gormus)
#### Post date: [October 23, 2023, 4:15pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/4 "2023-10-23T16:15:21Z")

</div>

Hey @JammyDodger I only tested it on [my desktop browser](https://arc.net/) actually:

```plaintext
Arc	118.0.5993.88 (Official Build) (arm64) 
Revision	1d05652f52a55dcf9a7905af94949f2bc3a66306-refs/branch-heads/5993@{#1298}
OS	macOS Version 14.0 (Build 23A344)
JavaScript	V8 11.8.172.15
User Agent	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

```

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [October 23, 2023, 4:27pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/5 "2023-10-23T16:27:03Z")

</div>

After a little ask around, it may already be fixed by this:

[https://github.com/discourse/discourse/pull/23935](https://github.com/discourse/discourse/pull/23935)

So hopefully updating your site should make everything come good. 🤞

---

<div class="post-metadata">

### Author: ![gormus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gormus/32/428592_2.png) [@gormus](https://meta.discourse.org/u/gormus)
#### Post date: [October 23, 2023, 7:12pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/6 "2023-10-23T19:12:43Z")

</div>

Confirming the upload works.

However, found another related bug: It doesn’t respect the `allow_multiple: true` option.

- I tried it once now selecting 3 images to upload at once.
- I noticed that images were uploaded, one after another, updating the preview line below the upload button.
- Once I saved it, I found the last uploaded image shown only.

---

<div class="post-metadata">

### Author: ![SaraDev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saradev/32/335139_2.png) [@SaraDev](https://meta.discourse.org/u/SaraDev)
#### Post date: [October 23, 2023, 8:26pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/10 "2023-10-23T20:26:03Z")

</div>

Hi Osman,

I wanted to confirm with you that we’ve deployed your site, which includes the [FIX: add missing `type` to form template upload by renato · Pull Request #23935 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/23935) update, so this should resolve the issues you were running into here.

If you still have any trouble with uploading files as you were describing here, please let us know. 🙂

---

<div class="post-metadata">

### Author: ![gormus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gormus/32/428592_2.png) [@gormus](https://meta.discourse.org/u/gormus)
#### Post date: [October 23, 2023, 9:07pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/12 "2023-10-23T21:07:30Z")

</div>

Hi @SaraDev My test forms are on [https://brighton-offsite-september-2023.discourse.group/](https://brighton-offsite-september-2023.discourse.group/) actually; an expired trial version; incase you’d like to check out its logs.

I checked the versions; it is using a later commit, so it should include that fix:

[https://github.com/discourse/discourse/commit/373b2ca36246405e80e5822da7421e668d7f1c8f](https://github.com/discourse/discourse/commit/373b2ca36246405e80e5822da7421e668d7f1c8f)

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [October 23, 2023, 9:15pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/13 "2023-10-23T21:15:15Z")

</div>

Hey @gormus,

Thank you for the feedback!

There’s indeed another issue with the uploads in combination with the `enable_direct_s3_uploads` site setting.

We’re working on a fix and we’ll let you know when it hits `tests-passed`.

---

<div class="post-metadata">

### Author: ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)
#### Post date: [November 3, 2023, 1:29pm UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/15 "2023-11-03T13:29:33Z")

</div>

Hi @gormus,

We recently fixed the `allow_multiple` uploads issue, as well as another one regarding the `file_types` validation.

Please let us know if you encounter any other issues.

Thank you!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [November 13, 2023, 7:24am UTC](https://meta.discourse.org/t/upload-fails-error-when-using-form-templates/283110/17 "2023-11-13T07:24:39Z")

</div>


