Is there a good way to automate the process of creating a new Thing for each photo when using a multiple photo uploader?
A little more context…
My app allows users to upload multiple photos as once - I’m using the AWS File Uploader plugin. And for each photo uploaded, I need to create a new Thing that contains 1 image and an associated list order number (my current setup requires this to allow users to sort photos).
Right now, I’m doing this in a manual way, by manually creating a long workflow, creating a new photo Thing like below for each individual photo.
Aside from being kind of a pain, the issue is that this limits the number of photos that can be uploaded to however many times I add this to the workflow.
I would like to offer users the option to upload “unlimited” photos or at least a large number like 50 or 100 at once. Is there a way to automate this process so that I can create a new Thing for x # of photos that are uploaded by the user?
@brandondereksmith - did you ever figure this out? I’m looking to do exactly the same thing and looking through the forum to see if there’s an answer out there already?
Hi @ddiaz, yes, I actually ended up using the method I mentioned until recently, but I switched to using a recursive API workflow to create the photos so it’s not limited to a specific number.
You can schedule an API workflow on a list, using the list of images that were uploaded, and then in the Backend workflows section, create a new Photo thing for each one. The only issue is that the ‘API workflow on a list’ functionality seems to break on lists over 100-200.
The better way I think is to make a recursive API workflow - here are some screenshots from my app on how it’s setup. (btw, I switched to Uploadcare instead of AWS so things might look a bit different from yours if you are using AWS):
My API workflow has these parameters set:
On the upload page, this is what the settings look like on the schedule api workflow:
Then in the backend workflow, you create the photo:
Then you can add the photo to the current user or profile, and as the last step in the workflow, schedule an api workflow and select the same workflow you are currently using. You increase the iteration by 1 to move to the next item in the list.
I’m using a ‘remaining’ parameter so the workflow only runs again if there are more Photos to create - this stops you from creating an endless loop. Alternatively, you could say only run the workflow if the iteration # is less than the # of image items in the list.
Hope that helps!
Thank you so much for the detailed response. That helps greatly - but also, it was what I feared. I was hoping to only add a few items, but then have those items attach themself as a list to another DB item, which I don’t believe the recursive workflow will do. But, I’ll have a think about whether that’s necessary - this solution looks great for the file upload part - thank you again, really appreciate it
@brandondereksmith - thought I’d share this with you as I’ve found the way to do what I was after, which may benefit you. Instead of using the “create a new thing” action natively in bubble, if you change the action to be “when a fileuploader is finished loading” and then create a new thing, the plugin will autocrat a line for each new item, which will save you having to do a recursive workflow. The only downside I can see so far, is that it can create the file much faster on the front end, but if you want to have other steps in the action, e.g., attach the files to another object, I haven’t figured that part out yet - but, the first part thought you may be interested in