Sunday, August 1, 2010

Re: file uploading. problems with ajax and jquery

thx dave...but cake is still asking for a view. thats what i did.

in the controller I render the element:
--------------------------------------------------------------
function uploadProfileImage()
{

$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('elements/previewProfileImage', 'ajax');

}


my element ctp:
--------------------------------------------------------------
<?php echo $html->image('profilepics/small/'.$user['image_path']); ?
>

and my view where the uploaded image shall appear:
--------------------------------------------------------------

<button
onClick="ajaxUpload(this.form,'uploadProfileImage','image_preview','&lt;br /
&gt;&lt;img src=\'../img/icons/loader.gif\' width=\'16\' height=\'16\'
border=\'0\' /&gt;','Error in upload'); return false;"
type="button">test</button>

<div id="image_preview">

</div>


what is shown in the target div "uploadProfileImage" is cake asking
for the view "uploadProfileImage"....i was hoping with render() to
solve that problem...or am i missing something here?

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: