# Any working examples of getting metadata from form fields?

**URL:** <https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640>\
**Category:** Uppy\
**Created:** [January 21, 2018, 4:57pm UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640 "2018-01-21T16:57:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![goatandsheep](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/goatandsheep/32/35_2.png) [@goatandsheep](https://community.transloadit.com/u/goatandsheep)\
**Post date:** [January 21, 2018, 4:57pm UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/1 "2018-01-21T16:57:03Z")

</div>

I’m trying to bring form data into my metadata object. I’m looking at the [bundled example](https://raw.githubusercontent.com/transloadit/uppy/c234da8d0bda4aa76536e50e2fb7828ab3472625/examples/bundled-example/index.html) and it claims to use a form with inputs of names `yo`, `bla`, and `check_test`. However, the [main.js file](https://github.com/transloadit/uppy/blob/c234da8d0bda4aa76536e50e2fb7828ab3472625/examples/bundled-example/main.js) (should it be a bundle.js?) has a metafields object:

```json
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.

---

<div class="post-metadata">

**Author:** ![artur](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/artur/32/15_2.png) [@artur](https://community.transloadit.com/u/artur)\
**Post date:** [January 25, 2018, 5:08pm UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/2 "2018-01-25T17:08:20Z")

</div>

Hi! In that example all of those fields will end up passed in the upload. They come from two different places:

1. Form plugin [Form | Uppy](https://uppy.io/docs/form/), it extracts metadata from a element that you pass to it.
2. `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](https://uppy.io/docs/dashboard/#metaFields). 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](https://uppy.io/docs/uppy/#meta).

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.

---

<div class="post-metadata">

**Author:** ![rajat-arora](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/rajat-arora/32/41_2.png) [@rajat-arora](https://community.transloadit.com/u/rajat-arora)\
**Post date:** [February 11, 2018, 11:16pm UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/3 "2018-02-11T23:16:15Z")

</div>

Hi. How Exactly would this work on uppy-server then? I want to be able to save the meta-data to a database.

---

<div class="post-metadata">

**Author:** ![ifedapoolarewaju](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/ifedapoolarewaju/32/36_2.png) [@ifedapoolarewaju](https://community.transloadit.com/u/ifedapoolarewaju)\
**Post date:** [February 13, 2018, 6:16am UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/4 "2018-02-13T06:16:28Z")

</div>

The metadata gets sent to uppy-server, and uppy-server adds it as part of its upload form fields

---

<div class="post-metadata">

**Author:** ![rajat-arora](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/rajat-arora/32/41_2.png) [@rajat-arora](https://community.transloadit.com/u/rajat-arora)\
**Post date:** [February 21, 2018, 2:02am UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/5 "2018-02-21T02:02:49Z")

</div>

> [@ifedapoolarewaju](#):
>
> The metadata gets sent to uppy-server, and uppy-server adds it as part of its upload form fields

Um okay… And how do we get access to the upload form fields, so that they can be saved into a database?

---

<div class="post-metadata">

**Author:** ![ifedapoolarewaju](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/ifedapoolarewaju/32/36_2.png) [@ifedapoolarewaju](https://community.transloadit.com/u/ifedapoolarewaju)\
**Post date:** [February 23, 2018, 1:37pm UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/6 "2018-02-23T13:37:54Z")

</div>

all this data is sent as form fields to the target multipart server, so you can read on your multipart server. Does this make sens to you?

---

<div class="post-metadata">

**Author:** ![nirorman](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@nirorman](https://community.transloadit.com/u/nirorman)\
**Post date:** [September 12, 2018, 6:49am UTC](https://community.transloadit.com/t/any-working-examples-of-getting-metadata-from-form-fields/14640/7 "2018-09-12T06:49:44Z")

</div>

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](mailto: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:

```auto
<form name="form" method="post">
First name:
<br>
<input type="text" name="firstname" value="">
<br>
Last name:
 <br>
<input type="text" name="lastname" value="">
<br>
Email address:
 <br>
<input type="text" name="email" value="" id="email">
 <br>
<br>
<input type="submit" value="Submit">
</form>

```

I have a `Form` in the main.js:

```auto
const Form = require('@uppy/form')
...
uppy.use(Form, {
target: 'form',
getMetaFromForm: true,
addResultToForm: true,
resultName: 'uppyResult',
submitOnSuccess: false
}

```
