M
M
mrrangerr2020-05-04 20:18:08
JavaScript
mrrangerr, 2020-05-04 20:18:08

How to download a file on click?

Good evening everyone, in my component, through props, a url for downloading a file comes, for example " https://api.unsplash.com/photos/AH21U9Mc2oQ/download "

How can I make a click-to-download download?
Tried via download attribute, doesn't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2020-05-04
@mrrangerr

through props comes the url to download the file,
maybe for download? Uploading usually to the server...
Tried via download attribute, doesn't work
give the correct headers from the serverside script:
Content-Disposition: attachment; filename="filename.jpg"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question