php - Showing validation errors for specific input field -


I have a form with file uploads for profile pictures, and I am validating file uploads like this:

  'Image' = & gt; Array ('kosher' => array ('rule' = & gt; 'valid image', 'message' = & gt; 'only images are allowed to upload'), 'size' => array ('Rule' = & gt; array ('fileSize', '<', '2MB', 'Message' = & gt; 'Picture must be less than 2 MB'))   

Verification runs, and works, but when I present the wrong data, no validation errors are shown on the formation. I am creating this kind of complete:

  & lt ;? Php echo $ this- & gt; Form- & gt; Create ('profile', array ('type' => gt; ')); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Hidden ('id'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Label ('profile picture', 'profile picture'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; File ('picture'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Input ('firstname'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Input ('lastname'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Input ('email', array ('between' = & gt; 'This is the email that other users will use for your contact')); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Input ('skill', array ('type' = & gt; 'text', 'value' => skill, 'labels' = & gt; 'your skills (each skill separate from space')); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Input ('course'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; Input ('bio'); ? & Gt; & Lt ;? Php echo $ this- & gt; Form- & gt; End ('Save Changes'); ? & Gt;   

Other field error messages appear correctly, just do not upload the file. How can I show verification errors around file input?

You used $ <-> <-> <-> <-> <-> <-> <-> & gt; Error ('Picture'); Below is the verification error message or $ this-> Form- & gt; Input ('Picture', array ('type' = & gt; 'file')); to generate file upload input

form :: input () is a wrapping method that generates the required input fields, label tags and if any The verification error message shows. Please read the manual.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -