# Http in POST with file attachement

**URL:** https://discourse.nodered.org/t/http-in-post-with-file-attachement/28901
**Category:** General
**Created:** [24 June 2020 16:14 UTC](https://discourse.nodered.org/t/http-in-post-with-file-attachement/28901 "2020-06-24T16:14:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Bond246](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bond246/32/16460_2.png) [@Bond246](https://discourse.nodered.org/u/Bond246)
#### Post date: [24 June 2020 16:14 UTC](https://discourse.nodered.org/t/http-in-post-with-file-attachement/28901/1 "2020-06-24T16:14:30Z")

</div>

Hello everyone,

i'm trying to define a flow with "http in"-node in POST-mode.

Idea is to upload a xml-file via http-POST from a different machine to node red. In node-red i want to use this file.

I've already configured the http-in with file upload and the http-request-node (200). With debug-node i can see the raw xml.  
But how can i use this raw data to translate it to json for example? Everyhing else within this http-in msg is not important to me i just need the data and the file-name.

Thanks and all the best,  
Bond

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [24 June 2020 18:42 UTC](https://discourse.nodered.org/t/http-in-post-with-file-attachement/28901/2 "2020-06-24T18:42:10Z")

</div>

take a look at the cookbook - [https://cookbook.nodered.org/basic/convert-xml](https://cookbook.nodered.org/basic/convert-xml)

---

<div class="post-metadata">

### Author: ![Bond246](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bond246/32/16460_2.png) [@Bond246](https://discourse.nodered.org/u/Bond246)
#### Post date: [25 June 2020 10:05 UTC](https://discourse.nodered.org/t/http-in-post-with-file-attachement/28901/3 "2020-06-25T10:05:48Z")

</div>

Hello @zenofmud ,

thanks for your fast reply.  
My problem was that the file-data was in a buffer, not in an (utf8)-string.

I now configured a function-node like this:

```auto
msg.payload = msg.req.files[0].buffer.toString('utf8');
return msg;

```

And now the new string-message was not a problem anymore for the xml-node.

Thanks  
Bond

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [9 July 2020 10:05 UTC](https://discourse.nodered.org/t/http-in-post-with-file-attachement/28901/4 "2020-07-09T10:05:55Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
