-2

How Can I download images to another folder using PHP?

Can anyone help me in downloading the images.

Bits Please
  • 877
  • 6
  • 23

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,346
  • 9
  • 33
  • 51
-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
  • 9,397
  • 10
  • 38
  • 65
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. – N.K Apr 24 '18 at 08:11