# How to download a file from dashboard

**URL:** <https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661>\
**Category:** Dashboard\
**Created:** [10 November 2020 10:30 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661 "2020-11-10T10:30:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JCLeuvennink](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JCLeuvennink](https://discourse.nodered.org/u/JCLeuvennink)\
**Post date:** [10 November 2020 10:30 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661/1 "2020-11-10T10:30:32Z")

</div>

Hi

I want to be able to download a file from remote computer, using my node-red dashboard. specifically, I want to click a button on the dashboard that then generates a CSV file from my database and then download it. I have seen some solutions where people use hyperlinks and http nodes to do this. As far as I can see through, all those solutions require you to hardcode a specific hyperlink with a specific file name. I want to be able to download the file I just created and thus need to specify the file name on the fly from the code. I would appreciate any ideas on how I can do this.

---

<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:** [10 November 2020 12:19 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661/2 "2020-11-10T12:19:33Z")

</div>

you could easily adapt [this](https://flows.nodered.org/flow/db68bd4934cf46f39e6e453a348bc419)

Replace the `file` node with your CSV generating code then pass it back to the endpoint.

---

<div class="post-metadata">

**Author:** ![JCLeuvennink](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@JCLeuvennink](https://discourse.nodered.org/u/JCLeuvennink)\
**Post date:** [2 December 2020 10:07 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661/3 "2020-12-02T10:07:12Z")

</div>

Hi, Thanks for your reply.

I thought about that, but it still requires the use of a hyperlink to start off the http request. I would like to start the process with a button click. So I guess I need a way to activate a hyperlink with a button press. is there any way for me to do that?

---

<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:** [2 December 2020 10:09 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661/4 "2020-12-02T10:09:26Z")

</div>

> [@JCLeuvennink](#):
>
> So I guess I need a way to activate a hyperlink with a button press. is there any way for me to do that

You can style any hyperlink to look identical to a button.

[lots of info](https://www.google.com/search?q=style+anchor+to+look+like+button)

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [2 December 2020 20:12 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661/5 "2020-12-02T20:12:22Z")

</div>

Another option is the use the "httpStatic" url setting to serve any files that exist in a public directory:

```auto
    // When httpAdminRoot is used to move the UI to a different root path, the
    // following property can be used to identify a directory of static content
    // that should be served at http://localhost:1880/.
    httpStatic: '/opt/nodered/public/',

```

The dashboard can then show a list of files that exist in the public directory, and clicking on them should try to either display or download the files contents (depending on the file extension).

---

<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:** [1 January 2021 20:12 UTC](https://discourse.nodered.org/t/how-to-download-a-file-from-dashboard/35661/6 "2021-01-01T20:12:29Z")

</div>

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