Getting a true http address from file object's uri (Drupal 7 I have created a little module to try and unzip files that has just been uploaded through node creation.  Here is my unzip function (the $file parameter is a file object):

function unzip($file) {
  watchdog('beep','Unzipping a project!!');
  $zip = new ZipArchive;
    //This Works
    $res = $zip-&gt;open(drupal_realpath($file-&gt;uri));
    // This does not
    //$res = $zip-&gt;open($file-&gt;uri);
  if ($res === TRUE) {
    $zip-&gt;extractTo("/Applications/MAMP/htdocs/sites/default/files/");
    $zip-&gt;close();
    watchdog('Zip sucess','Unzipping worked!' . drupal_realpath($file-&gt;uri));
  } else {
    watchdog('Zip Failure','Unzipping failed for ' . drupal_realpath($file-&gt;uri));
  }
}


Included in this snipet are two different ways I attempted to open the zip file.

This first one works on my local MAMP server but would not work on a producitons server:

$res = $zip-&gt;open(drupal_realpath($file-&gt;uri));


This created a path like this:

/Applications/MAMP/htdocs/sites/default/files/Tumble arcade file_5.zip


and

$res = $zip-&gt;open($file-&gt;uri);


creates a path like this:

public://Tumble arcade file.zip


Now the first path is interpreted correctly by $zip->open and the file is unzipped correctly but with the second path, the zip open fails.  I believe this is happening because php does not know how to handle the second path and needs something more like this:

http://localhost/sites/default/files/Tumble%20arcade%20file_5.zip


Am I on the right track and if so how would I get this other kind of path?  If not, any idea what might instead be the problem?
There's a nice in-built function, file_create_url():


  Creates a web-accessible URL for a stream to an external or local file.


e.g.

$url = file_create_url($file-&gt;uri);