Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » multiple conditions in UploadField?

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 197 Views
  • _Vince
    Community Member
    161 Posts

    multiple conditions in UploadField? Link to this post

    I'm trying to check for two (or possibly more) conditions in an UploadField.

    Basically, I want to allow some image types and make sure they're no bigger than 1Mb.

    The problem is that all the examples I've seen only show ONE condition, ie the following does not work.

          $LogoImageField = new UploadField('LogoImage');
          $LogoImageField->getValidator()->allowedExtensions = array('jpg', 'gif', 'png', 'JPG', 'GIF', 'PNG');

    How can I rewrite this to have more than one condition?

    Thanks in advance.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.