In a file component, the user is not shown the list of acceptable file extensions. If they submit a file with an extension not on the list, they will get an error message with the list. It would be better UI to give the user this information in advance.

I suggest Webform add text such as the following to the description for file components:
Allowed file extensions: jpg, png, gif.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Liam Morland’s picture

Likewise, the maximum file size should be shown.

Liam Morland’s picture

Status: Active » Needs review
FileSize
644 bytes

Fix.

quicksketch’s picture

Thanks Liam! This has been one of those things I've been wanting to do for a long time.

Rather than making our own message, maybe we should reuse the theme_file_upload_help() function provided by file.module?

   $element['#description'] = theme('file_upload_help', array('description' => $element['#description'], 'upload_validators' => $element['#upload_validators']));
Liam Morland’s picture

A very sensible suggestion! See attached.

quicksketch’s picture

Issue summary: View changes
Status: Needs review » Fixed

Super. Finally committed. Thanks again Liam.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

fenstrat’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Closed (fixed) » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 7.x-4.x-dev » 8.x-4.x-dev
Assigned: Unassigned » fenstrat
Status: Closed (fixed) » Patch (to be ported)

Needs porting to 8.x-4.x.

fenstrat’s picture

Version: 8.x-4.x-dev » 7.x-4.x-dev
Assigned: fenstrat » Unassigned
Status: Patch (to be ported) » Fixed

Committed and pushed 9bc891c to 8.x-4.x. Thanks!

  • Commit 5889b00 on 8.x-4.x authored by Liam Morland, committed by fenstrat:
    Issue #2106849 by Liam Morland: Allowed file extensions should be shown...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.