[Zope] Check uploaded file for valid contents

Tino Wildenhain tino@wildenhain.de
Tue, 29 Oct 2002 23:24:47 +0100


Hi Andreas,

the most simple approach is
to limit this a bit in the HTML Form:

<input type="file" name="Name" accept="application/pdf">

This would only show pdf-documents in the file requester.

Then again you can use the file-object in the form
and validate it before passing to
manage_addFile()

Regards
Tino
--On Dienstag, 29. Oktober 2002 22:32 +0100 Andreas Tille <tillea@rki.de> 
wrote:

> Hello,
>
> I wonder if there is an elegant method to check a file which is intended
> to be stored as (Ext)File in the ZODB according to the validity of its
> contents.  The reason is thatr I have to store some PDF files but I have
> users who do not really know the difference between DOC and PDF.  I want
> to refuse DOCs (or any other non-PDF) to enforce users to upload just PDF.
>
>
> Kind regards
>
>        ANdreas.
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )