Multiple input fields in the same form

Archived from the Transloadit support forum. Originally posted on November 6, 2011; details may be outdated, see our docs for current behavior. Original thread

Hi guys,

I want a user to upload two different types of files in the same form. So I’d like to use a different template for each of these two inputs. How is this possible with transloadit? I sure don’t want to use 2 . I’m confused because the “params” hidden input seems to be unique and to take only one template_id parameter.

thanks!

(was “use 2 <form>s”)

Are the files going to be of different types? (for example an image and a video?).

If so, you can have a “switch” in your template by simply using an /image/resize and an /video/encode robot with "use": ":original" and they will only process their respective types.

Let me know if that works for you.

Hi Felix,

No, unfortunately I’m uploading two different images (an icon and a logo) that I’d like to process differently. Any other solution ? My form is already developed and breaking it in two parts is not an option…

Thanks!

I’ve tried http://transloadit.com/blog/2010/11/advanced-use-conditions-for-assembly-steps but I get the error :

: One of your step parameters includes an non-array {use: …} value.

{bucket

what am I doing wrong?

thanks

Sorry, template is :

{"export-icon":  {"robot":"/s3/store","key":"REDACTED","secret":"REDACTED","bucket":"static.platform.joshfire.com","use":{"fields":["icon"]}}}

Hi,

sorry when you specify the fields parameter you also have to specify the steps parameter. We will fix this in our next sprint.

"use": {
     "steps": [":original"],
    "fields": ["icon"]
  }

Kind regards,
Karl Skomski

Thanks it works :slight_smile: