[html-formfu] Constraining filenames for upload fields

Carl Franks fireartist at gmail.com
Wed Jul 30 18:44:29 BST 2008


2008/7/30 Will Hawes <wdhawes at gmail.com>:
> I'd like to add a constraint to a form to limit the file suffix a user
> is allowed to enter into an upload field. This is not to check file
> type (that's done elsewhere in my code), rather it is intended to make
> the form slightly more user friendly by trying to catch
> invalid-looking file names early on.

There's a Constraint::File::MIME - if you'd rather still just check
the file extension, you could use it as a basis for a new
Constraint::File::Ext module.

Cheers,
Carl



More information about the HTML-FormFu mailing list