Question

how do i force download a file

we are setting up a website that hosts mp3 files on spaces. We want it in such way that if the visitor clicks download, the mp3 doesn’t have to open a player. We want instant download

how do we achieve this with spaces?

sample link https://spacename.sfo2.digitaloceanspaces.com/filename.mp3

with dropbox i could easily add &dl=1

how does it work with spaces?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

What you could do is modify the metadata of the file and set the Content-Disposition which indicates if a regular file should be displayed inline in the web browser or downloaded as an attachment. For more information you could take a look at the official documentation here:

https://www.digitalocean.com/docs/spaces/how-to/set-file-metadata/

Hope that this helps! Regards, Bobby