Copy remote JPG on your site with PHP


/ Published in: PHP
Save to your folder(s)

Used to copy the user avatar from Facebook to your community in this [Facebook Connect Tutorial](http://www.barattalo.it/facebook-connect-tutorial/ "Tutorial").


Copy this code and paste it in your HTML
  1. function copyFile($url,$filename){
  2. $file = fopen ($url, "rb");
  3. if (!$file) return false; else {
  4. $fc = fopen($filename, "wb");
  5. while (!feof ($file)) {
  6. $line = fread ($file, 1028);
  7. fwrite($fc,$line);
  8. }
  9. fclose($fc);
  10. return true;
  11. }
  12. }

URL: http://www.barattalo.it/2010/01/16/copying-remote-files-on-your-server-with-php/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.