New Field Type "Upload: File Name" in module Views
This include file for module Views (/modules/views/modules/views_upload.inc) implements views functionality on behalf of upload.module.
<?php
// $Id: views_upload.inc,v 1.1 2006/06/12 21:44:53 vadbars Exp $
function upload_views_tables() {
$tables['files'] = array(
'name' => 'files',
'provider' => 'internal',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid'
),
'right' => array(
'field' => 'nid'
),
),
'fields' => array(
'filename' => array(
'name' => t('Upload: File Name'),
'sortable' => true,
'handler' => 'views_handler_field_filename',
'option' => string,
'help' => t('This will display the file name.'),
),
),
);
return $tables;
}
function views_handler_field_filename($fieldinfo, $fielddata, $value, $data) {
return l($value, 'files/'.$value);
}
?>