# Add topic field to File-In node

**URL:** https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376
**Category:** Feature Requests
**Created:** [18 December 2021 06:57 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376 "2021-12-18T06:57:36Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [18 December 2021 06:57 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/1 "2021-12-18T06:57:36Z")

</div>

Hi folks,

One of the things I need is an easy way to combine two files into a single message. Since the Join-node already allows me to combine messages based on their topic, it would be very useful for me if the File-In node would allow me to _**specify a topic (in the config screen)**_:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7e50f08512d43d498c8693a504a628345e477a55.png)

I can't solve it by two extra Change nodes, like this:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b101852c9bc156a9df375c4ddaf498e82cf77097.png)

Because the File-In node doesn't pass the input message topic in this case... We could solve this by _ **passing the input msg topic to the output** _. However my flow is already quite long, and these extra Change-nodes would make it harder to read.

So I would like to propose two changes:

1. The msg.topic of the input message is passed to the output in all cases (in [this](https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/nodes/core/storage/10-file.js#L363) code).

2. Add a topic field to the config screen. If that is filled, then this topic is being used instead the one from the input message.

Thanks!!  
Bart

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [18 December 2021 07:08 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/2 "2021-12-18T07:08:09Z")

</div>

The join node doesn't have to use the topic as the key. It could use msg.filename instead, (or whatever extra field the file node has)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/1530e6471e3b32823736c677813b7eab06309cac.png)

But yes to 1 anyway, we should fix that.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [18 December 2021 07:50 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/3 "2021-12-18T07:50:56Z")

</div>

> [@dceejay](#):
>
> But yes to 1 anyway, we should fix that.

Yup, that should be fixed.

> [@BartButenaers](#):
>
> Add a topic field to the config screen. If that is filled, then this topic is being used instead the one from the input message.

No. Topic has no meaning with the file node. If we were to add it to this node, it would be hard to explain why _this_ node gets that treatment, and then why not add it to every single node. We don't want to do that.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [18 December 2021 10:07 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/4 "2021-12-18T10:07:05Z")

</div>

> [@dceejay](#):
>
> It could use msg.filename instead

Hey Dave,  
Thanks!! That indeed does the job very well. Why haven't I seen that myself ...  
Believe it or not, but first time I use this Join node in my flows.  
Works like a charm! So indeed then I don't need the topic on the config screen.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [18 December 2021 11:49 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/5 "2021-12-18T11:49:53Z")

</div>

**Post removed at Bart's request as he has amended the original post**.

Leaving a reminder to all here that messing with Public Key Infrastructure (PKI) - e.g. certificates and keys - is hard to get right and easy to end up with something that seems secure but really isn't.

If you need to rely on it for anything important, please remember to get your deployment checked by professionals.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [18 December 2021 18:04 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/6 "2021-12-18T18:04:04Z")

</div>

@BartButenaers - hmm - just got to a keyboard and tried it... - for me the topic and any other properties get passed through the file-in mode just fine - can't see what needs fixing.

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [18 December 2021 18:09 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/7 "2021-12-18T18:09:13Z")

</div>

Really? That is weird... I have also tested it this morning and my topic was gone. Will try tonight again. Now I am in mathematics mode, to assist with my son's examination preparation 😉  
BTW thanks for testing already!!

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [18 December 2021 22:36 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/8 "2021-12-18T22:36:13Z")

</div>

> [@dceejay](#):
>
> for me the topic and any other properties get passed through the file-in mode just fine

Hey Dave,  
Yes you are right. Did a new test and it works fine... I don't have my flow anymore from this morning, so not sure what I did wrong at that time.  
Sorry for the inconvenience!!! And thanks again for having a look at it!!

---

<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: [18 December 2021 23:22 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/9 "2021-12-18T23:22:27Z")

</div>

You know I had the same issue about a week or two ago and was going to look into it, but I was down with a nasty cold and it dropped off my radar. I’ll have a go at seeing if I can reproduce it.

---

<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: [19 December 2021 00:40 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/10 "2021-12-19T00:40:59Z")

</div>

Went back thru all my projects that had been updated in the last two weeks on my different devides and can't reproduce it (sigh). Of course I did update one today...but can't remember what release it was on 😳

---

<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: [17 February 2022 00:41 UTC](https://discourse.nodered.org/t/add-topic-field-to-file-in-node/55376/11 "2022-02-17T00:41:49Z")

</div>

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