Skip to content
Advertisement

How to download an image on device from a direct URL using PHP?

This might seem a repeated question, but trust me I have read many topics here, none of the solutions worked for me ????

What I particularly aim to do is, let’s say I have this image URL – https://catfriendly.com/wp-content/uploads/2019/06/AdobeStock_53119595.jpeg, and I want to Download it on my user’s phone. I would redirect the user to URL when he/she clicks the download button, and then the URL’s image would be downloaded on the user’s phone. Is this possible to do?

I’ve tried this code,

JavaScript

What’s wrong in this one? Thanks!

Advertisement

Answer

I think the problem with your code is that it is executed on your server, but not on the user’s phone.

So you have to modify your code a little:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement