I think we have a misunderstanding. The code I sent you was for your
model. The only thing that changes was you had some code in the
"afterValidate" function and I provided you with an alternative to do all
the legwork in the "beforeValidate" function.
If you use "beforeValidate" you can do all
Charles, thank you for the great effort!
But is there no other option than move the validation into the controller
instead of doing it in the model?
The code I wrote only contains one single if/else and is very clear to me.
Okay, it's not working so I'm not getting anywhere for the moment huh ;)
You can get rid of the $unset_photo variable I didn't end up using it.
--Charles
On Sat, Feb 28, 2015 at 6:48 PM, Charles Beasley
wrote:
> I'm sorry.. I replied quickly via cell phone. A better response is as
> follows.
>
> Try the following code:
>
>
>
> class Outlet extends CoasterCmsAp
I'm sorry.. I replied quickly via cell phone. A better response is as
follows.
Try the following code:
array(
'rule' => 'notEmpty', // verplicht
'message' => 'Nameis required.',
'allowEmpty' => true
),
'intro' => array(
'rule
I think you should change your function to beforeValidate
On Feb 28, 2015 5:54 PM, "Sam Clauw" wrote:
> Okay Charles , that makes sense so I changed my code:
>
>
>
> class Outlet extends CoasterCmsAppModel
> {
> public $validate = array(
> 'name' => array(
> 'rule' => 'no
Okay Charles , that makes sense so I changed my code:
array(
'rule' => 'notEmpty', // verplicht
'message' => 'Nameis required.',
'allowEmpty' => true
),
'intro' => array(
'rule' => 'notEmpty', // verplicht
'message' => 'I
#x27;] is transitioning from an array to a string. You would have to
make sure that $this->data['Outlet']['photo'] contains a string value when
validate() is executed. Is it possible that your afterValidate function is
supposed to be beforeValidate?
--Charles
On Sat, Feb
I have a problem with my file upload validation in CakePHP.
When I add a new record with an image upload field...
- ... image should be required.
- ... image file extension sould be jpg, png or gif.
When I edit an existing record with an image upload field...
- ... image is not
CakePHP's validation system doesn't come with file upload validation
rules.
Try using the uploader plugin:
http://www.milesj.me/resources/script/uploader-plugin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goo
After I submit the add meda file form without selecting a file I am
printing out $this->data, I end up with the following result:
Array
(
[MediaFile] => Array
(
[uploaded_file] => Array
(
[name] =>
[type] =>
I would just like to start by saying this is my first project using
CakePHP and my second attempt at using a MVC (I just read a book on
the asp.net mvc framework) framework so please bear with me.
I am having a problem validating a file upload. I have a very simple
project setup with 2 models (ca
You can use my file upload plugin, it comes bundled with validation
rules.
http://www.milesj.me/resources/script/uploader-plugin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group,
I do in this way:
http://trac.chipotle-software.com/karamelo/browser/trunk/app/controllers/users_controller.php
line 236:
public function avatar()
{
I check if fil was uploaded and if is a valid file, in this case an
image:
if ( $type != 'image/jpeg' && $type != 'image/pjpeg' && $type !=
'ima
Hi All,
I have done with file uploading functionality in cakephp. But i want
to apply validation (i.e. Please upload file.. ) . How to actieve
this. I have created $validate array in model.
waiting for reply. Please guide me.
--~--~-~--~~~---~--~~
You received th
14 matches
Mail list logo