-2

How Can I download images to another folder using PHP?

Can anyone help me in downloading the images.

Bits Please
  • 867
  • 6
  • 20

2 Answers2

0

You can only access the files in the localhost (xampp\htdocs..) using PHP. Other files in the system can't be accessed.

Munawir
  • 3,308
  • 8
  • 32
  • 49
-1

You can read content of URL using file_get_contents() method and then save the data received as image using file_put_contents()

 $content = file_get_contents('http://www.mysql.com/abc.png');
 file_put_contents('/image/abc.png', $content);
Atul Sharma
  • 7,910
  • 10
  • 36
  • 60
Masterton
  • 21
  • 3
  • 1
    That's good to begin with, adding more informations/explanations is a good way to improve your answer, as it is right now it doesn't deserve this title. – xoxel Apr 24 '18 at 08:11