I have and thumbnail image url which i want to download and save to the local directory. How can I do it in javascript?
Asked
Active
Viewed 3,494 times
1 Answers
1
As the commenter mentioned, you can use the download
attribute. However, this is very new and won't work in older browsers.
Other than that, you can't do this purely through JavaScript. This is because the headers needed to force the download are set on the server, via something like PHP. See this answer.
Whatever you do, you will need the user to agree to the download in the first place, but I assume you're aware of that.
-
i am using curl now to download the image and saving it as a file. – Gourav Saha Apr 20 '16 at 11:56