You can check if a session element exists by using the check method 
(http://book.cakephp.org/view/403/check).

So:

if ($this->Session->check('abc.imageuploaded')):
        do something;
else:
        do nothing;
endif;

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 6 Aug 2010, at 12:33, Tomfox Wiranata wrote:

> hey everyone,
> 
> in my controller I need to make a check if an image was uploaded or
> not. the way to find this out is to check a specific session variable
> for its value. lets say the user does upload an image. then I code:
> 
> session.write('abc.imageuploaded', "true);
> 
> in case no image is uploaded I write nothing in this session value.
> now I tried to make the check like this:
> 
> if ($this->session->read('abc.imageuploaded') == "true"){
> 
> do stuff
> 
> }
> 
> else{
> 
> do other stuff
> 
> }
> 
> 
> unfortunately cake kinda skips my check an executes the if-clause
> everytime. i also tried
> 
> if (empty($this->session->read('abc.imageuploaded')) but cake doesnt
> like that at all
> 
> looking forward to your help :)
> 
> thx
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to