Get a file URL from a custom entity referenced on a user profile I have an entity called CV which is used to store uploaded CVs. The entity is created and referenced on the user profile using inline entity form. I need to get the fid for the cv so I can do this:

$uri = file_load($fid)-&gt;uri;
$file_name = file_load($fid)-&gt;filename;
$path = file_create_url($uri);


I've tried to use entity_metadata_wrapper, but I'm not sure how to actually access the correct field. This is an example of what I've been trying:

$wrapper = entity_metadata_wrapper('candidate_cv', $cv);
$cv_file = $wrapper-&gt;field_candidate_cv-&gt;value();   


Which returns this error:

EntityMetadataWrapperException: Unknown data property field_candidate_cv.


Update:
I have managed to get the title of the entity using this:

$cv_wrapper = entity_metadata_wrapper('user', $user);
$cv_upload = array();
foreach ($cv_wrapper-&gt;field_cv-&gt;value() as $index =&gt; $feature) {
    $cv_upload[] = $feature-&gt;title;
}
echo title[0];


But I can't get to the fid of the file field which is field_candidate_cv.

$cv_wrapper = entity_metadata_wrapper('user', $user);
   $cv_upload = array();
   foreach ($cv_wrapper-&gt;field_cv-&gt;value() as $index =&gt; $feature) {
        $cv_upload[] = $feature-&gt;field_candidate_cv;
    }
    $fid = $cv_upload[0]['fid'];


$fid prints nothing.

However, in this $fid prints Array:

 $fid = $cv_upload[0];
Solution:

$cv_wrapper = entity_metadata_wrapper('user', $user);
$cv_upload = array();
foreach ($cv_wrapper-&gt;field_cv-&gt;value() as $feature) {
    $cv_upload[] = $feature-&gt;field_candidate_cv;
}
$fid = $cv_upload[0]['und'][0]['fid'];


Printed the array of $cv_upload using:

drupal_set_message('&lt;pre&gt;'. print_r($cv_upload, TRUE) .'&lt;/pre&gt;');