Hi François:

Could you send us an example of two records where the unique constraint is
not working with upload fields?

What are you expecting?

IIRC, there are some parameters for Field so you can handle the file name
uniqueness, but generally that is not a good idea as other users could be
uploading a different file but with the same filename, and there could be a
name collision if you store the files in the disk.
Please see:

http://web2py.com/books/default/chapter/29/07#SQLFORM-and-uploads

If don't want that the contents to be repeated, maybe you have to use blobs:

http://web2py.com/books/default/chapter/29/06

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com


On Wed, Jan 2, 2013 at 11:53 AM, François Delpierre <
francois.delpie...@gmail.com> wrote:

> Hi,
>
> The unique constraint is not working in the following Field definition.
>
>     Field('f_xlsfile', type='upload', notnull=True,
>           requires=[
>               IS_UPLOAD_FILENAME(extension='^xlsx?$',
>                   error_message='Please post .xls or .xlsx Excel files
> only.'),
>               IS_LENGTH(1048576*2, 1024,
>                   error_message='File size must be between 1kB & 2048kB'),
>               ],
>           unique=True,
>           label=T('Excel file')),
>
>  --
>
>
>
>

-- 



Reply via email to