# Ui-Table download local file

**URL:** <https://discourse.nodered.org/t/ui-table-download-local-file/23165>\
**Category:** Dashboard\
**Created:** [16 March 2020 10:28 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165 "2020-03-16T10:28:36Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [16 March 2020 10:28 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/1 "2020-03-16T10:28:36Z")

</div>

Hello

I try unsuccessfully to download a local file using Table.

I managed to do this using httpStatic , like `msg.payload[i].Local = "<a href=\"/file.txt\" download=\"file.txt\"> Download File </a>";`

I can't do the same thing without using httpStatic.  
I tried somethink like : `msg.payload[i].Local = "<a href=\"file:///C:\\Temp\\file.txt\">Download File</a>";` , but nothing is happening.

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [16 March 2020 10:53 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/2 "2020-03-16T10:53:22Z")

</div>

Have you tried just using the "File In" node instead?

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [16 March 2020 13:51 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/3 "2020-03-16T13:51:11Z")

</div>

How do I do this?

`msg.payload[i].Local` is an array with tens or even hundreds of values. He only points to a link, which will be accessed optionally. If I put `File in`, it would mean uploading tens or hundreds of files.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 March 2020 14:06 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/4 "2020-03-16T14:06:09Z")

</div>

I don't understand what you mean, what is the difference between downloading a file from the local file system using an http download or reading directly with File In node? It is just a different way of reading the same file.

**[Edit]** Obviously only read in the file if the user clicks on the table to say he wants it.

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [16 March 2020 14:36 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/5 "2020-03-16T14:36:44Z")

</div>

Simple Flow

```auto
[{"id":"436d07b6.730df","type":"tab","label":"Test","disabled":false,"info":""},{"id":"68cddff5.d3496","type":"ui_table","z":"436d07b6.730df","group":"5bf85515.163b74","name":"Test","order":15,"width":"14","height":"2","columns":[{"field":"Link","title":"Link","width":"","align":"left","formatter":"link","formatterParams":{"target":"_blank"}},{"field":"Local","title":"Local File","width":"","align":"left","formatter":"html","formatterParams":{"target":"_blank"}}],"outputs":1,"cts":true,"x":930,"y":240,"wires":[[]]},{"id":"e79d54f8.dfd26","type":"inject","z":"436d07b6.730df","name":"Go","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":510,"y":240,"wires":[["d91d55b4.c8faf"]]},{"id":"d91d55b4.c8faf","type":"function","z":"436d07b6.730df","name":"Rows","func":"msg.payload = [];\n\nvar row1 = {\n Link : \"http://www.google.com\",\n Local : \"<a href=\\\"file:///C:\\\\Temp\\\\File_1.txt\\\">File_1</a>\"\n};\n\nmsg.payload.push(row1);\n\n\nvar row2 = {\n Link : \"http://www.google.com\",\n Local : \"<a href=\\\"file:///C:\\\\Temp\\\\File_2.txt\\\">File_2</a>\"\n};\n\nmsg.payload.push(row2);\n\n\nreturn msg;","outputs":1,"noerr":0,"x":700,"y":240,"wires":[["68cddff5.d3496","3e3403e8.b7eeec"]]},{"id":"3e3403e8.b7eeec","type":"debug","z":"436d07b6.730df","name":"Rows","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":930,"y":160,"wires":[]},{"id":"5bf85515.163b74","type":"ui_group","z":"","name":"Default","tab":"83b20082.0c1de","disp":true,"width":"14","collapse":false},{"id":"83b20082.0c1de","type":"ui_tab","z":"","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]

```

When I click on File\_1 or File\_2 , I need to download the files (from local HDD & Windows OS), without using httpStatic

---

<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:** [16 March 2020 15:36 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/6 "2020-03-16T15:36:53Z")

</div>

If you are only downloading from the local device, why do you have links to google?

if you put a debug node of the output of the ui-table node wht do you see when you click one of the items?

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [16 March 2020 15:48 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/7 "2020-03-16T15:48:07Z")

</div>

Google links ... just example, can be ignored.

`topic: "Local"`  
`row: 0`  
`payload:{"Link":"http://www.google.com","Local":"<a href=\"file:///C:\\Temp\\File_1.txt\">File_1</a>"}`

---

<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:** [16 March 2020 16:05 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/8 "2020-03-16T16:05:14Z")

</div>

So from the debug can you see any way to determine if you clicked on the link or the local file?

If you can, what node could you use to send the message one way if it was link and the other way it if was local?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 March 2020 16:08 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/9 "2020-03-16T16:08:27Z")

</div>

> [@softy2k](#):
>
> without using httpStatic

Why don't you want to use httpStatic?

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [16 March 2020 17:00 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/10 "2020-03-16T17:00:46Z")

</div>

Colin, I use a lot of files. Some are generated by other applications in various folders. Others come from the local network.

---

<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:** [16 March 2020 19:17 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/11 "2020-03-16T19:17:40Z")

</div>

You going to answer my question or are you all set?

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [16 March 2020 19:42 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/12 "2020-03-16T19:42:18Z")

</div>

zenofmud , please illuminate me with a functional flow. I understand the meaning of your questions, but I got stuck.

---

<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:** [16 March 2020 20:35 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/13 "2020-03-16T20:35:30Z")

</div>

I'll illuminate you with probing questions.

Which of the standard nodes do you think you could use to test a value (multiple times) and send the output different ways depending on the result?

---

<div class="post-metadata">

**Author:** ![softy2k](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/softy2k/32/23707_2.png) [@softy2k](https://discourse.nodered.org/u/softy2k)\
**Post date:** [17 March 2020 07:36 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/14 "2020-03-17T07:36:09Z")

</div>

I solved this using this example [Download a file from node-red using standard nodes](https://flows.nodered.org/flow/db68bd4934cf46f39e6e453a348bc419) from the flows library

---

<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:** [17 March 2020 09:38 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/15 "2020-03-17T09:38:12Z")

</div>

Congratulations! (hope you don't mind but I edited your post to show the name of the example and link it for anyone looking at this in the future)

---

<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:** [16 April 2020 09:38 UTC](https://discourse.nodered.org/t/ui-table-download-local-file/23165/16 "2020-04-16T09:38:17Z")

</div>

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