Upload a file to Drupal server from an outside URL I am trying to cache in the server the profile images provided by the Facebook Graph API. 
So far what I did unsuccessfully was getting the path of the image then calling:

$file = file_save_upload($big_pic_url, array(), $dest, FILE_EXISTS_RENAME);


This returns NULL every time. I tried several syntax for the destination path, and also for the Pic URL path, nothing seems to work. 

I am doing this the right way? Can file_save_upload() take an external link as part of its argument?
Here is a solution I've used recently for a Facebook module. Set the image path to $path variable (ie. http://graph.facebook.com/username/picture). Then do the following to store it via Drupal's managed file system:

$image = file_get_contents($path); // this is a PHP function to get a string representation of the image file

$destination = 'public://path/to/store/this/image/name.jpg'; // a stream wrapper path where you want this image to reside on your file system including the desired filename

$file = file_save_data($image, $destination, FILE_EXISTS_REPLACE);

if (is_object($file)) { // if you get back a Drupal $file object, everything went as expected so make the status permenant
   $file-&gt;status = 1;
   $file = file_save($file);
}