Same name and namespace in other branches
  1. 4.7.x modules/upload.module \upload_menu()
  2. 5.x modules/upload/upload.module \upload_menu()
  3. 6.x modules/upload/upload.module \upload_menu()

Implementation of hook_menu().

File

modules/upload.module, line 52
File-handling and attaching files to nodes.

Code

function upload_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/upload',
      'title' => t('uploads'),
      'callback' => 'upload_admin',
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  else {

    // Add handlers for previewing new uploads.
    if ($_SESSION['file_uploads']) {
      foreach ($_SESSION['file_uploads'] as $key => $file) {
        $filename = file_create_filename($file->filename, file_create_path());
        $items[] = array(
          'path' => $filename,
          'title' => t('file download'),
          'callback' => 'upload_download',
          'access' => user_access('view uploaded files'),
          'type' => MENU_CALLBACK,
        );
        $_SESSION['file_uploads'][$key]->_filename = $filename;
      }
    }
  }
  return $items;
}