Wednesday, January 23, 2013

Need help with file uploads

I followed this tutorial: http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper%3a%3afile

My View / Form
<?php echo $this->Form->create("User", array("enctype" => "multipart/form-data")); ?>
<?php echo $this->Form->hidden("User.id"); ?>
<?php echo $this->Form->input("User.picture_file", array("type" => "file")); ?>
<?php echo $this->Form->submit("Edit Member"); ?>

My Controller
if($this->request->is('put') || $this->request->is('post')){
if($this->User->save($this->request->data))
debug($this->data);
}

$this->User->save is working perfectly.

My Debug of $this->data
array(  	'User' => array(  		'id' => '12',  		'email' => 'test@test.com',  		'first_name' => 'Shahruk',  		'last_name' => 'Khan',  		'department' => 'TS',  		'position' => 'dsaa',  		'title' => '',  		'city' => 'aa',  		'state' => '0',  		'zip' => '11111',  		'country' => '1'  	)  )

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: