Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Edge 25 posts 79 karma points
    Jun 03, 2020 @ 01:39
    Anthony Edge
    0

    Can I use regex or any other approach to limit file upload file sizes?

    Hey folks, We've got a client request to allow photo submissions via their website. They have Formulate 1.3.1 which supports file attachments. But how can we limit the file size people try to upload? Many email servers won't send out large attachments and incoming email (and hosting server storage limits) also come into play. Any help appreciated. Thx, AE

    Edit: And can we restrict file types/extensions?

  • Nicholas Westby 2045 posts 7032 karma points c-trib
    Jun 03, 2020 @ 02:48
    Nicholas Westby
    0

    Regex would probably not work, but you could probably create a custom validation or a custom field. For example, the Recaptcha field does server side validation to validate that the answer is correct. You could do something similar.

    Refer to the code for examples. Let me know if you need any tips about where to look.

    BTW, regex might work to validate file extensions, but I can't remember if the regex validation works for file upload types.

Please Sign in or register to post replies

Write your reply to:

Draft