Vian Ojeda Garcia
Vian Ojeda Garcia

Reputation: 867

HTML download not correct file type

I am trying to have a download link on my html. But upon doing when I download the file the file extension is not correct. It's just says File instead of a csv file type.

<a href="test.csv" download="filename">Download link</a>           

what i'm doing wrong?

Upvotes: 2

Views: 3830

Answers (1)

Kosh
Kosh

Reputation: 18393

The download attribute specifies that the target will be downloaded when a user clicks on the hyperlink.

This attribute is only used if the href attribute is set.

The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the correct file extension and add it to the file (.img, .pdf, .txt, .html, etc.).

If the value is omitted, the original filename is used.

https://www.w3schools.com/tags/att_a_download.asp

<a href="test.csv" download>Download link</a>

Upvotes: 2

Related Questions