How to set name of file downloaded from browser?

When they click a button to download the file, you can add the HTML5 attribute download where you can set the default filename.

That’s what I did, when I created a xlsx file and the browser want to save it as zip file.

<a href="https://stackoverflow.com/questions/3102226/path/to/file" download="renamed.txt">Download</a>
<a href="downloads/export.xlsx" download="Data-Export.xlsx">Download Export</a>

Leave a Comment