Slugs are indeed a good idea, but if you really want to force no spaces you
can use a regex with IS_FILE.
Something like requires=IS_FILE(filename=re.compile('^[^\s]+$'))
Note that you probably still want to use IS_SLUG because this will not
prevent people from using \, /, ?, .. and other stuff that you probably
don't want in URLs
A domingo, 26 de fevereiro de 2023 à(s) 15:03:08 UTC, Massimiliano escreveu:
> Maybe you can manage the thing server side.
> Take a look here:
>
>
> https://stackoverflow.com/questions/18951515/how-can-i-create-unique-slugs-for-url-use-in-web2py
>
>
> Il giorno dom 26 feb 2023 alle 14:51 Wayne Shirley <[email protected]>
> ha scritto:
>
>> I need to prevent a user from being able to upload an image file that has
>> spaces in the file name.
>>
>> Eventually the filename will be included in a url as part of a CMS.
>>
>> Is there a built-in function in web2py that does this?
>>
>> How to go about this?
>>
>> Thanks.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/c4419907-4957-4326-9323-6772284266aen%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/web2py/c4419907-4957-4326-9323-6772284266aen%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> Massimiliano
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/c65d99dc-403a-48b0-9333-e05aa1a41291n%40googlegroups.com.