0

I set login with google in my website and google get me some url like enter image description here so i not have form then how i upload this url image to my directory?

i have no resources from any site for this issue.

Pramod Gharu
  • 1,097
  • 3
  • 9
  • 18
ImBhavin95
  • 1,444
  • 2
  • 15
  • 27

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,659
  • 1
  • 8
  • 19