i need to style the input[type="file"], the only way to really style them is to add a <label> which has the same for value as the input's id. Drupal does not provide a correct label in single input[type="file"] upload and even no label in multiples input[type="file"] uploads. Is there any way to solve this issue?


1 Answer 1


The markup in Drupal is always overridable. In this case, you may either need to use a hook_form_alter() in a custom module to modify the label html, override the theme_file() theme function (which is responsible for producing the markup for the file input element), or theme the form specifically. Any of these three methods should be able to meet your needs (although I'm partial to the theme_file() approach).

  • Many thanks coreyp, i used the theme_file() theme function. Its works with single and multiple file uploads, just need to add <label for="' . $element['#attributes']['id'] . '">Text</label> Jul 29, 2014 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.