How do I choose from my computer two files to upload and send form, then works perfectly. But sometimes I would like upload only one file (Photo.0.image) and the secend input file (Photo.1.image) leave empty. I prepare Photo::beforeValidate for this:
public function beforeValidate($options = array()) {
if(empty($this->data['Photo']['image']['tmp_name'])) {
unset($this->data['Photo']);
}
return true;
}
But my SaveAll() return false and results for pr($this->News->validationErrors) is:
Array (
[Photo] => Array (
[1] => Array ()
)
)
What going on?
Any idea?
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment