File uploader element in collection

When I use the Drag & Drop Uploader element on a collection, it ceases to function.

This is used on a product page to attach files to use for printing. Some products have 1 file needed, other 2, 3, 4, or more. A collection seemed to solve for the number of files needed. But, the uploader will allow me to select a file from my computer, but after the file is selected, nothing works after that.

(context: beginning no-coder with no JS experience). I searched the community and didn’t see quite this scenario.

I experienced a similar behaviour, yesterday.

:eyes: interested to know if this is a limitation or bug?

The normal ui does not work when the component is inserted in a repeated container.
single:
image

repeated:
image

all the components have files selected so this may be a bug.

Apart from that the component works and you can use it as any other input in a repeated container: you need to create a variable that will hold the values and update it with the “on change” event where you can access the input value.

See this topic for an example

Seems to be a bug, could you report this on support.weweb.io? We’ll have a look!

Ticket submitted. Thank you

For people having the same issue, its not a bug. Once dropped inside a repeated list, components loose their internal variable, you have to update the logic of the displayed files list yourself to replace the component variable (became unknown) with your variable holding the list of files.

Same with the visibility of the list

You will use the onChange workflow to update you file list variable, use this variable in the formula instead of the unknown ones.

3 Likes

I’m not sure how to configure the workflow. The 3 actions in the normal OnChange workflow should be remove, right?

Here’s my new variable:

In the OnChange workflow, I get the value (no path?):

Finally, the Items is the variable, but I don’t get the URLs:

Not sure what you’re doing… but maybe try it such that in step 3 of the first screenshot (change var value), change it to the result of step 2 of your first screenshot (upload image function) under the section where you can use the result of prior workflow actions… so you don’t have to use item data

Yes, that I understand for a “normal” upload file, but when in a collection list, I just can’t add the input element. That’s why I suppose I need to create the variable, but I just don’t know how to use it in the workflow.

The variables are visible when I add a upload file element NOT in a collection list. When adding in a collection list, the variables are not visible.

variable

@Alexis in case you can help me again, thanks!

Hi, I think you’re struggling with an old limitation. When an element is repeated, element variables are not available anymore. The workaround is to store the value in a variable using the onchange event on the file input. But then, you end up limited by the current upload file action as you cant use a variable, you have to select a file input.

I don’t have any solution yet but I will create a product ticket so we can improve the upload action and allow you to bind a variable containing the file for example, instead of a file input.

Edit : What people do in your situation is adapt the UI so the upload is only displayed one by one, not in a repeat, for example by opening a modal for the selected row.

2 Likes

Would allowing a variable of type “File” to be created help solve this?

Screenshot 2023-10-04 at 9.58.28 AM

Nope, you can already use the Query or Object type I think to store the file inside a variable.

The issue is the upload file action, it take a file input as parameter (the file input element, you have to choose one in your page), so you can’t use a variable containing a file instead.

@Alexis do you have any update about this limitation, because I have to build a functionality where a user -just like a form builder- has the ability to add an image and text so my data structure has to be repeated, so the action of uploading a file is not visible for me because the file uploader has to be in the page and not in the repeated element,please advise

You need to save the upload resut array into an array and then work with it.

@Broberto the thing is that the upload element can’t be seen in the workflow if it’s in a repeated element

Hi,

Hi think its solvable if we allow you to bind the file (in addition to be able to select a file element), so you could bind the file from a variable where you stored it, as suggested by @Broberto

We solved this in the new encode file as base64 action, we should be able to apply the same logic for this issue. I will make a ticket and try to handle it in the next 2 weeks :slight_smile:

1 Like

Hi Alexis, any update on this topic here ? sorry to ask, it’s very urgent for me to solve it

Hi, it has been released 9 days ago as stated by the release note :slight_smile:

@Alexis that’s great thank! but how do I save the upload result in an array, I can’t seem to find the action that does that in the workflow, thank you!