Sunday, April 1, 2012

Re: Image Upload

You can't save files with AJAX. Are you using a JS script that's using the iframe hack?

On Saturday, March 31, 2012 12:41:41 PM UTC-7, aSh!Q's wrote:
I wanted to upload a picture of the user via ajax. I checked the media plugin but found it a little bit hard seeing all those instructions. Is there any better way ? What is the best way ?
I was thinking of using the submit option of the jshelper . And i created the following page. 



<?php

echo $this->Form->create('Photo',array('type'=>'file'));
echo $this->Form->file('Photo.image');
echo $this->Js->Submit('Add Picture',array('url'=>'/users/savepicture','class'=>'button',
'before'=>$this->Js->get('#right-box')->effect('fadeOut') ,
'success'=>$this->Js->get('#right-box')->effect('fadeIn'),'update'=>'#right-box'
));
echo $this->Form->end(); 
echo $this->Js->writebuffer();
?>


In the controller I tried to debug ($this->data) just to get an understanding of how the file is uploaded . But i see no data being uploaded . The debug returns an empty array . Help me ??

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

No comments: