[html-formfu] new file upload constraints

Carl Franks fireartist at gmail.com
Mon Jan 21 10:16:36 GMT 2008


On 18/01/2008, Вячеслав Тихановский <viacheslav.t at gmail.com> wrote:
> 2008/1/18, Carl Franks <fireartist at gmail.com>:
> > There's a File::MIME constraint with types() and regex() methods.
> > types() accepts either a single MIME-type, or an array-ref of MIME-types.
> > If none of these exactly match the browser-submitted Content-Type (or
> > types() wasn't set), then regex() is matched against it.
> > The regex uses the '\x' flag, so whitespace is ignored.
> >
> >     constraints:
> >       name: file
> >       type: File::MIME
> >       regex: '^ image / (?: jpeg | png ) \z'
> >
>
> I guess it should be like this? =)
>

> -        return $input =~ /$input/x;
> +        return $input =~ /$regex/x;

silly mistake...
Thanks - that's fixed in svn now!

Carl


More information about the HTML-FormFu mailing list