fileupload_view

Versions
4.6
fileupload_view($node, $main = 0, $page = 0)
4.7 – 5
fileupload_view(&$node, $teaser = FALSE, $page = FALSE)

Implementation of hook_view.

Code

developer/examples/fileupload.module, line 92

<?php
function fileupload_view(&$node, $teaser = FALSE, $page = FALSE) {
  if ($file = $node->file) {
    // Only create link to file when it is in the proper location.
    if ($file->filesize && file_check_location($file->filepath, file_directory_path())) {
      $node->body = l($file->filename, file_create_url($file->filepath));
    }
    else {
      $node->body = $file->filename;
    }
    // display the file's size
    $node->body .= ' ('. format_size($file->filesize) .')';
  }

  return theme('node', $node, $teaser, $page);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.