I’m trying to bring form data into my metadata object. I’m looking at the bundled example and it claims to use a form with inputs of names yo, bla, and check_test. However, the main.js file (should it be a bundle.js?) has a metafields object:
metaFields: [
{ id: 'license', name: 'License', placeholder: 'specify license' },
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
]
which doesn’t make sense because {‘license’, ‘caption’} =/= {‘yo’, ‘bla’, ‘check_test’}
Are there any working examples of doing this? I’m struggling a lot with figuring out how the names convert to id’s.
Hi! In that example all of those fields will end up passed in the upload. They come from two different places:
Form plugin Form | Uppy, it extracts metadata from a element that you pass to it.
metaFields is a Dashboard plugin’s option for your users to be able to edit files before upload and specify the metadata themselves: Dashboard | Uppy. But those will only be specified if user actually edits the file:
Note that this meta data will only be set to a file if it’s entered by user. If you want to set certain default meta field to each file regardless of user actions, set meta in Uppy options.
So, you can pass meta to Uppy uploads: 1. via meta object in Uppy settings, 2. via setMeta() method, 3. via Form plugin or 4. via metaFields in Dashboard.
Plenty of options, which leads to some confusion, sorry about that.
Hi Artur, I’m interested in option #3, the Form plugin.
I have a form in which users fill in their email address and I want the files uploaded to s3 to have that email in their path. for example: mymail@gmail.com/2018-09-12_09-41-11/image_name.jpg
How can I reach the form’s fields from within uppy/examples/aws-companion/server.js?
I managed to add the datetime, but how do I reach form.email?
I have a form object in the index.html: