it's probably better to show the whole validation in my controller:
if ( !empty( $this->data ) ){ //check if form is submitted
if (!$this->data['User']['name']) { //check for uploaded file
in $this->data
$this->set('error','Du hast kein Bild angegeben');
$this->render('previewprofileimage','ajax');
} else {
if (($this->data['User']['name']['type'] !=
'image/jpeg') ||
($this->data['User']['name']['type'] != 'image/png') || ($this-
>data['User']['name']['type'] != 'image/gif')) {
$this->set('error','Du kannst nur Bilder
hochladen(jpeg, png,
gif)');
$this->render('previewprofileimage','ajax');
} else { // process upload and resizing and saving the
image
$image_path =
$this->Image->upload_image_and_thumbnail($this-
>data,"",200,150,$this->Session->read('User.username'), true);
$updates =
$this->User->findByUsername($this->Session-
>read('User.username'));
$updates['User']['image_path']=
$updates['User']['username']."/".
$updates['User']['username'].".jpg";
$this->User->save($updates);
$this->render('previewprofileimage','ajax');
}
}
}
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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en