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] => file_link
[#file] => stdClass Object
(
[fid] => 196
[display] => 1
[description] =>
[uid] => 1
[filename] => drupal-7-theming-cheat-sheet.pdf
[uri] => public://drupal-7-theming-cheat-sheet_0.pdf
[filemime] => application/pdf
[filesize] => 224804
[status] => 1
[timestamp] => 1348746651
[type] => undefined
[rdf_mapping] => Array
(
)
)
[#access] => 1
)
The printed array for $output2 is:
Array
(
[#theme] => file_link
[#file] => stdClass Object
(
[scalar] => drupal-7-theming-cheat-sheet.pdf
)
[#access] => 1
)
Any ideas? Thanks for your help!