function theme_file

7.x theme_file($variables)
5.x theme_file($element)
6.x theme_file($element)

Returns HTML for a file upload form element.

For assistance with handling the uploaded file correctly, see the API provided by


$variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #title, #name, #size, #description, #required, #attributes.

Related topics

4 theme calls to theme_file()
FileFieldDisplayTestCase::testNodeDisplay in drupal/modules/file/tests/file.test
Tests normal formatter display on node display.
file_managed_file_process in drupal/modules/file/file.module
Process function to expand the managed_file element type.
theme_file_formatter_table in drupal/modules/file/
Returns HTML for a file attachments table.
theme_file_link in drupal/modules/file/file.module
Returns HTML for a link to a file.
182 string references to the theme hook from theme_file()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

aggregator_form_opml in drupal/modules/aggregator/
Form constructor for importing feeds from OPML.
aggregator_menu in drupal/modules/aggregator/aggregator.module
Implements hook_menu().
aggregator_theme in drupal/modules/aggregator/aggregator.module
Implements hook_theme().
AJAXFrameworkTestCase::testLazyLoad in drupal/modules/simpletest/tests/ajax.test
Test that new JavaScript and CSS files added during an AJAX request are returned.
authorize_get_filetransfer in drupal/includes/
Gets a FileTransfer class for a specific transfer method and settings.

... See full list


drupal/includes/, line 4031
Functions for form and batch generation and processing.


function theme_file($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'file';
  element_set_attributes($element, array('id', 'name', 'size'));
  _form_set_class($element, array('form-file'));

  return '<input' . drupal_attributes($element['#attributes']) . ' />';