# Parametric file read, given a message.payload.filename

**URL:** <https://discourse.nodered.org/t/parametric-file-read-given-a-message-payload-filename/46861>\
**Category:** General\
**Created:** [8 June 2021 13:49 UTC](https://discourse.nodered.org/t/parametric-file-read-given-a-message-payload-filename/46861 "2021-06-08T13:49:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![0x180](https://avatars.discourse-cdn.com/v4/letter/0/8c91f0/32.png) [@0x180](https://discourse.nodered.org/u/0x180)\
**Post date:** [8 June 2021 13:49 UTC](https://discourse.nodered.org/t/parametric-file-read-given-a-message-payload-filename/46861/1 "2021-06-08T13:49:06Z")

</div>

I am trying to expose a little rest api interface to download files from a given folder.  
So the first API return a file list and the second should let the client, download the desired file.

I have not understand yet how to parametrize the file path to serve back to the caller, is it possibile?

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

Here the flow i working on :

```auto
[{"id":"c06e05db.96e4a8","type":"tab","label":"File System","disabled":false,"info":""},{"id":"ca72d632.dfc5f8","type":"fs-file-lister","z":"c06e05db.96e4a8","name":"","start":"C:\\Users\\s.scarinzi\\Desktop","pattern":"*.*","folders":"*","hidden":true,"lstype":"files","path":true,"single":true,"depth":0,"stat":true,"showWarnings":true,"x":380,"y":240,"wires":[["23da456.99b5eba"]]},{"id":"eb542d88.7457f","type":"http in","z":"c06e05db.96e4a8","name":"","url":"getFiles","method":"get","upload":false,"swaggerDoc":"","x":150,"y":240,"wires":[["ca72d632.dfc5f8"]]},{"id":"23da456.99b5eba","type":"http response","z":"c06e05db.96e4a8","name":"","statusCode":"200","headers":{},"x":720,"y":240,"wires":[]},{"id":"bdd968b9.bcee58","type":"http in","z":"c06e05db.96e4a8","name":"","url":"readFile","method":"post","upload":false,"swaggerDoc":"","x":160,"y":420,"wires":[["e2724d4e.80219","1de1fee8.1704a1"]]},{"id":"e2724d4e.80219","type":"debug","z":"c06e05db.96e4a8","name":"IN","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":350,"y":340,"wires":[]},{"id":"588ac55.dafe03c","type":"debug","z":"c06e05db.96e4a8","name":"OUT","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":560,"y":340,"wires":[]},{"id":"1de1fee8.1704a1","type":"file in","z":"c06e05db.96e4a8","name":"","filename":"","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":380,"y":440,"wires":[["588ac55.dafe03c"]]}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 June 2021 15:28 UTC](https://discourse.nodered.org/t/parametric-file-read-given-a-message-payload-filename/46861/2 "2021-06-08T15:28:08Z")

</div>

Here is a working demo

[https://flows.nodered.org/flow/db68bd4934cf46f39e6e453a348bc419](https://flows.nodered.org/flow/db68bd4934cf46f39e6e453a348bc419)

---

<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:** [7 August 2021 15:28 UTC](https://discourse.nodered.org/t/parametric-file-read-given-a-message-payload-filename/46861/3 "2021-08-07T15:28:36Z")

</div>

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