You can certainly detect extension of the uploaded file (see andyhot's
post), but as you know any user can forge it by simply renaming a
file.

In case of graphics though, almost every format includes some form of
METADATA which you can use with Java imaging API to detect if the
submitted file is truly a JPEG or PNG or whatever format you want.

I suggest you read up on java.awt.* javadoc.


On 3/6/06, Nick Westgate <[EMAIL PROTECTED]> wrote:
> Hi Andy.
>
> Great. It's nice to see those doing the difficult or impossible. ;-)
> Was this accepted into T4? I look forward to using it one day.
>
> Cheers,
> Nick.
>
>
> [EMAIL PROTECTED] wrote:
> > However, an "accept" validator, to be used like this:
> >
> >   <component id="file" type="Upload">
> >     <binding name="file" value="file"/>
> >     <binding name="displayName" value="message:filename"/>
> >     <binding name="validators" value="validators:accept=gif-jpeg-other"/>
> >   </component>
> >
> > was described in this list:
> >
> > http://article.gmane.org/gmane.comp.java.tapestry.user/26835
> > http://article.gmane.org/gmane.comp.java.tapestry.user/26841
> >
> >>From Nick Westgate <[EMAIL PROTECTED]>:
> >
> >
> >>Hi Vincent.
> >>
> >>This has nothing to do with Tapestry.
> >>
> >>In general it is difficult or impossible because of browsers.
> >>Google for it.
> >>
> >>E.g.
> >>http://www.cs.tut.fi/~jkorpela/forms/file.html#filter
> >>
> >>Cheers,
> >>Nick.
> >>
> >>
> >>Vincent wrote:
> >>
> >>>Is there any news about this?
> >>>
> >>>On 2/28/06, Vincent <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>>e.g. I only like to choose all the file end with .jpg , the other
> >>>>format will be ignored.
> >>>>How can I archive this?
> >>>>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to