How do I extract filename and filepath from a file field? Here is what I am trying to tackle: I would like to allow a zip file to be uploaded via the default filefield upload widget for a content type. I am using hook_node_presave to take the zip file and extract is using a helper function based off of the core update manager. The error I am receiving is: 


  Notice: Undefined index: filename in filefield_unzip_node_presave() (line 18 of
  /sites/all/modules/filefield_unzip/filefield_unzip.module).
     Notice: Undefined index: uri in filefield_unzip_node_presave() (line 19 of
  /sites/all/modules/filefield_unzip/filefield_unzip.module).
     Exception: Archivers can only operate on local files:  >not supported in archiver_get_archiver() (line 8149 of /include
  /common.inc).


Here is my code:

/**
* @file

* Allows uploading and extracting a zip file uploaded to a file field.
*/

/**
 * 
 * Implementation of hook_node_presave($node)
 * 
 */

function filefield_unzip_node_presave($node) {
if($node-&gt;type == 'game') {
    if (!empty($node-&gt;field_game_files)) {
        $zipFile = $node-&gt;field_game_files['und'][0]['filename'];
        $zipDirectory = $node-&gt;field_game_files['und'][0]['uri'];

        _filefield_unzip_archive_extract($zipFile, $zipDirectory);
    }
}
}

/**
 * 
 * Copy of the function used by the update manager update_manager_archive_extract($file, $directory)
 * 
 */

function _filefield_unzip_archive_extract($file, $directory) {
$archiver = archiver_get_archiver($file);
if (!$archiver) {
    throw new Exception(t('Cannot extract %file, not a valid archive.', array('%file' =&gt; $file)));
}

//Remove the directory if it exists, otherwise it might contain a mixture of old files mixed with new files (e.g. in cases where files
//were removed from a later release).
$files = $archiver-&gt;listContents();

//Unfortunately, we can only use the direct name to determine the project name. Some archivers list the first file as the directory (i.e., MODULE/)
//and others list an actual file (i.e., MODULE/README.TXT).
$project = strtok($files[0], '/\\');

$extract_location = $directory . '/' .$project;
if (file_exists($extract_location)) {
    file_unmanaged_delete_recursive($extract_location);
}

$archiver-&gt;extract($directory);
return $archiver;
}
I found a solution to this, however stackexchange won't let me add an answer for 8 hours. I have it all typed out so if I forget to come back and upload it feel free to post on here to request the answer and remind me.


go on...