# How do I make a button that downloads a file

**URL:** <https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846>\
**Category:** Hosting Support\
**Created:** [August 2, 2024, 9:25am UTC](https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846 "2024-08-02T09:25:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Topher7lol](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/topher7lol/32/59404_2.png) [@Topher7lol](https://forum.infinityfree.com/u/Topher7lol)\
**Post date:** [August 2, 2024, 9:25am UTC](https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846/1 "2024-08-02T09:25:18Z")

</div>

I was just wondering how I can make a button that when you click downloads a certain file?

---

<div class="post-metadata">

**Author:** ![Meishin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/meishin/32/59902_2.png) [@Meishin](https://forum.infinityfree.com/u/Meishin)\
**Post date:** [August 2, 2024, 9:33am UTC](https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846/2 "2024-08-02T09:33:09Z")

</div>

Just link to the file with the `download` attribute:

```auto
<a href="/path/to/file" download>Download</a>

```

This will tell the browser that the file is for download, not for viewing. The browser will usually still download unpreviewable files like `.zip`.

Do note that our hosting is not for file sharing, so you probably want to find somewhere else to host these files.

---

<div class="post-metadata">

**Author:** ![Topher7lol](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/topher7lol/32/59404_2.png) [@Topher7lol](https://forum.infinityfree.com/u/Topher7lol)\
**Post date:** [August 2, 2024, 10:27am UTC](https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846/3 "2024-08-02T10:27:21Z")

</div>

but like image, exe, etc? how would i make it so when it goes to that file it just automatically downloads it?

---

<div class="post-metadata">

**Author:** ![Topher7lol](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/topher7lol/32/59404_2.png) [@Topher7lol](https://forum.infinityfree.com/u/Topher7lol)\
**Post date:** [August 2, 2024, 10:27am UTC](https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846/4 "2024-08-02T10:27:51Z")

</div>

Ah nvm I see the download part of it, thanks so much.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [August 9, 2024, 10:28am UTC](https://forum.infinityfree.com/t/how-do-i-make-a-button-that-downloads-a-file/96846/5 "2024-08-09T10:28:49Z")

</div>

Closed on August 9, 2024, 10:28am UTC

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