0

I set login with google on my website and google get me some url like enter image description here So I do not have a form then how do I upload this url image to my directory?

I have no resources from any site for this issue.

Ahmad Adibzad
  • 501
  • 2
  • 6
  • 14
ImBhavin95
  • 1,494
  • 2
  • 16
  • 29

1 Answers1

1

Without using CI libaray.Lets try...

$url = 'https://lh3.googleusercontent.com/-MzgndtILI5I/AAAAAAAAAAI/AAAAAAAAAAs/qB7MkGWroIY/photo.jpg';
/* Extract the filename */
$filename = substr($url, strrpos($url, '/') + 1);
/* Save file wherever you want */
file_put_contents('upload/'.$filename, file_get_contents($url));

Also take reference from here... Saving image from PHP URL and Uploading image with url address in Codeigniter

Community
  • 1
  • 1
Hikmat Sijapati
  • 6,869
  • 1
  • 9
  • 19