# Multiple binary - access with json expression filename

**URL:** <https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685>\
**Category:** Questions\
**Tags:** data-transformation, read-binary-file\
**Created:** [April 19, 2024, 5:25pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685 "2024-04-19T17:25:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pooria](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pooria/32/14482_2.png) [@pooria](https://community.n8n.io/u/pooria)\
**Post date:** [April 19, 2024, 5:25pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685/1 "2024-04-19T17:25:46Z")

</div>

## Describe the problem/error/question

Follow up to this

> [@Multiple binary data access filename](http://community.n8n.io/t/multiple-binary-data-access-filename/35146):
>
> Describe the problem/error/question I have 2 binary files from the input node and I can’t access the “filename” of one of the binary data. This expression doesn’t return anything: {{ $binary[“Featured Image\_0”].filename }} What is the error message (if any)? Please share your workflow (Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.) Share the output returned by the last node Information on your n8n setup …

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/0/6/06223b610c3054da2d0c273dd2da3a75436b30eb.png)

I have 3 binary files coming from the input node:

-data  
-data\_overlay  
-firstname\_lastname\_ig

**I want to JUST target and pass along the the last binary using this expression:**

{{ $binary[$json.property\_first\_name + ‘\_’ + $json.property\_last\_name + ‘\_IG’].fileName }}

**But that returns undefined.**

If I use this expression to just target that specific binary:

{{ $binary.Alex\_Jack\_IG.fileName }}

It returns this “Alex \_Jack\_IG” which is good, but it’s not always that Alex\_Jack, it can be Sam\_Jack for example (different names).

Any thouhgts on how I can use $binary and access a specific fileName with json expressions in brackets?

## What is the error message (if any)?

I get “undefined”.

## Please share your workflow

```auto
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

```

## Share the output returned by the last node

## Information on your n8n setup

- \*\*n8n version:\*\*1.38
- **Database (default: SQLite):**
- \*\*n8n EXECUTIONS\_PROCESS setting (default: own, main):\*\*own
- \*\*Running n8n via (Docker, npm, n8n cloud, desktop app):\*\*Docker
- **Operating system:**

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [April 19, 2024, 7:16pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685/2 "2024-04-19T19:16:10Z")

</div>

> [@pooria](#):
>
> {{ $binary.Alex\_Jack\_IG.fileName }}

If the binary filed is dynamic, you can get it via the object keys method:

```auto
{{ $binary[Object.keys($binary)[0]].fileName }}

```

---

<div class="post-metadata">

**Author:** ![pooria](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pooria/32/14482_2.png) [@pooria](https://community.n8n.io/u/pooria)\
**Post date:** [April 19, 2024, 10:39pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685/3 "2024-04-19T22:39:27Z")

</div>

that worked. thx

---

<div class="post-metadata">

**Author:** ![pooria](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pooria/32/14482_2.png) [@pooria](https://community.n8n.io/u/pooria)\
**Post date:** [April 19, 2024, 10:40pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685/4 "2024-04-19T22:40:07Z")

</div>

What if I want to dynamically target the binary file not based on the order/number (e.g. [0] ) but base on the name (e.g. [$json\_first\_name]?

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [April 20, 2024, 12:38pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685/5 "2024-04-20T12:38:38Z")

</div>

That [0] is not the number, it means to take the first key from the list of keys.  
You can use the name as well:

`{{ $binary[$json_first_name].fileName }}`

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/36532_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [July 19, 2024, 12:39pm UTC](https://community.n8n.io/t/multiple-binary-access-with-json-expression-filename/44685/6 "2024-07-19T12:39:03Z")

</div>

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