I have a controller Job and controller User I want to send post data from the view of Job Controller to User controller the form contains file upload option too
$this->Form->create('User',array('url'=>array('controller'=>'Users','action'=>'newUser')),array('type' =>'file','enctype'=>'multipart/form-data'))
it will give the out put
<form action="/User/newUser" id="UserViewForm" method="post" accept-charset="utf-8">
but it is not adding attribute of enctype="multipart/form-data" to form
Try this
$this->Form->create('User',
array('type' => 'file', 'class' => 'classname', 'url'=>array('controller'=>'Users','action'=>'newUser') ) );
You don't need to create a separate array for the all options.
Docs: Form Options
<?php
echo $this->Form->create('User', array('url' => array('controller' => 'Users','action' =>'newUser'),'class'=>'classname','enctype'=>'multipart/form-data'));
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.