function theme_file

Returns HTML for a file upload form element.

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

Parameters

$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

1 theme call to theme_file()
system_element_info in modules/system/system.module
Implements hook_element_info().

File

includes/form.inc, line 4205

Code

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']) . ' />';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.