# POST file with metadata

**URL:** <https://community.dreamfactory.com/t/post-file-with-metadata/3729>\
**Category:** REST API\
**Created:** [March 24, 2017, 12:25pm UTC](https://community.dreamfactory.com/t/post-file-with-metadata/3729 "2017-03-24T12:25:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![schoel](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@schoel](https://community.dreamfactory.com/u/schoel)\
**Post date:** [March 24, 2017, 12:25pm UTC](https://community.dreamfactory.com/t/post-file-with-metadata/3729/1 "2017-03-24T12:25:12Z")

</div>

Hi,

Your API docs seem to indicate that I can attach metadata to files that I upload to DSP. I just cannot figure out how to do that. In POST /files/{file\_path} it says the schema for the body is:

```
{
  "name": "string",
  "path": "string",
  "content_type": "string",
  "metadata": [
    "string"
  ]
}

```

But where does the file content go in this case? On the other hand, I can post the file contents directly, but how do I attach metadata then?

As an example often explains things best, could you give me a plain but complete HTTP request (as opposed to a PHP/JavaScript/whatever API call) that would do the following:

- uploads file foo.txt
- with content type text/plain
- and content “Foo Bar Baz”
- as well as metadata item “bar=baz”

Thanks.

---

<div class="post-metadata">

**Author:** ![trekuartista](https://avatars.discourse-cdn.com/v4/letter/t/ba8739/32.png) [@trekuartista](https://community.dreamfactory.com/u/trekuartista)\
**Post date:** [March 24, 2017, 4:46pm UTC](https://community.dreamfactory.com/t/post-file-with-metadata/3729/2 "2017-03-24T16:46:16Z")

</div>

> [@schoel](#):
>
> text/plain  
> and content “Foo Bar Baz”  
> as well as metadata item “bar=baz”

Hello, You can upload files, with the content in base64 encode. Here is an example with an S3 to upload a File:

POST /api/v2/url HTTP/1.1  
Host: domainName  
X-DreamFactory-Api-Key: Your DreamFactoryApiKey  
Content-Type: application/json

{  
“resource”: [{  
“name”: “FileName.txt”,  
“type”: “file”,  
“is\_base64”: true,  
“content”: “file content with base64 encode goes here”  
}  
]  
}

---

<div class="post-metadata">

**Author:** ![schoel](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@schoel](https://community.dreamfactory.com/u/schoel)\
**Post date:** [March 27, 2017, 7:44am UTC](https://community.dreamfactory.com/t/post-file-with-metadata/3729/3 "2017-03-27T07:44:51Z")

</div>

Thanks, that’s another nice way of posting a file. But what about the metadata? The API talks about such a field, it being an array of strings. Yet, it does not appear to actually be stored. Does it require a specific backend (you are talking about S3 in your answer, I am using local file storage)? Is it a leftover from the past? A hint to the future?
