Render filename of file upload field in node template I have a field for uploading a file. And in *node--content_type.tpl.php* I want to just print the filename of the uploaded file.

So far I have this

$node = node_load($nid);
//get field item in correct language
$item = field_get_items('node', $node, 'field_file_upload');
//get field_file_upload value
$output1 = field_view_value('node', $node, 'field_file_upload', $item[0]);
print render($output1);


But it renders a link to the download and a thumbnail of the download type.

I want to just print out the filename. I tried using:

$output2 = field_view_value('node', $node, 'field_file_upload', $item[0]['filename']);
print render($output2);


But this renders a thumbnail of the download type e.g PDF icon rather than showing the filename.

The printed array for $output1 is:

Array
(
    [#theme] =&gt; file_link
    [#file] =&gt; stdClass Object
        (
            [fid] =&gt; 196
            [display] =&gt; 1
            [description] =&gt; 
            [uid] =&gt; 1
            [filename] =&gt; drupal-7-theming-cheat-sheet.pdf
            [uri] =&gt; public://drupal-7-theming-cheat-sheet_0.pdf
            [filemime] =&gt; application/pdf
            [filesize] =&gt; 224804
            [status] =&gt; 1
            [timestamp] =&gt; 1348746651
            [type] =&gt; undefined
            [rdf_mapping] =&gt; Array
                (
                )

        )

    [#access] =&gt; 1
)


The printed array for $output2 is:

Array
(
    [#theme] =&gt; file_link
    [#file] =&gt; stdClass Object
        (
            [scalar] =&gt; drupal-7-theming-cheat-sheet.pdf
        )

    [#access] =&gt; 1
)


Any ideas? Thanks for your help!
I think you missed a key in between. Try,

$output2 = field_view_value('node', $node, 'field_file_upload', $item[0]);
foreach ($output2 as $key) {
  if(is_object($key)) {
    echo "File Name: ".$key -&gt; filename;
  }
}