I have trouble downloading an image when clicking on an image link.
I'm prepending download?image=
before the image url, it is giving the save option but fails to get downloaded.
Here is my code:
<a href={`download?image=${data[0].compress_path}`} download={(data[0].file_name).substring(data[0].file_name.lastIndexOf('/') + 1)} type="application/octet-stream" target="_blank">Download</a>
Note:Without using download?image= it is opening image in new tab.