when i upload image in form using cakephp at that time the image is insert but other data will not inserted...??

Hi,

you have to share more information about the issue, the form and the controller code could also help.

how can i display image in my index.ctp page after submit form.....

//MayanksController.php that is my controller file
<?php
App::uses('Controller', 'Controller');
class MayanksController extends Controller
{
    public function index()
    {
        $data=$this->Mayank->find("all");
        $this->set("result",$data);
    }
    public function insert()
    {
       if($this->request->is('post'))
       {
           $this->Mayank->create();
           $this->set("result");
           if($this->Mayank->save($this->request->data))
           {
              $this->redirect('index');
           }
       }
    }
    public function delete($id=null)
    {
       if($this->Mayank->delete($id))
       {
           $this->redirect('index');
       }
    }
    public function update($id=null)
    {
        $data=$this->Mayank->findById($id);
        if($this->request->is('post')||$this->request->is('put'))
        {
            if($this->Mayank->save($this->request->data))
            {
                $this->redirect('index');
            }
        }
        $this->request->data=$data;
    }
}

//index.ctp that is my index file
<?php echo $this->html->link('Add',array('controller'=>'Mayanks','action'=>'insert')); ?>
<table>
  <tr>
      <th>Id</th>
      <th>Name</th>
      <th>Email</th>
      <th>Gender</th>
      <th>City</th>
      <th>Profile</th>
      <th>Action</th>
  </tr>
  <?php
     foreach($result as $res):
  ?>
  <tr>
      <td><?php echo ($res['Mayank']['id']);?></td>
      <td><?php echo ($res['Mayank']['name']);?></td>
      <td><?php echo ($res['Mayank']['email']);?></td>
      <td><?php echo ($res['Mayank']['gender']);?></td>
      <td><?php echo ($res['Mayank']['city']);?></td>
      <td><?php echo ($res['Mayank']['profile']);?></td>
      <td><?php echo $this->html->link('Delete',array('Controller'=>'Mayanks','action'=>'delete',$res['Mayank']['id']));?>
          <?php echo $this->html->link('Update',array('Controller'=>'Mayanks','action'=>'update',$res['Mayank']['id']));?>
      </td>
  </tr>
  <?php
    endforeach;
  ?>
</table> 

//insert.ctp that is my insert file to store the data into the database
<h2>Add Information</h2>
<?php
echo $this->form->create();
echo $this->form->input('name');
echo $this->form->input('email');
echo $this->form->input('gender',array('type'=>'radio','options'=>array('male'=>'Male','female'=>'Female')));
echo $this->form->input('city',array('type'=>'select','options'=>array(0=>'select city','surat'=>'surat','baroda'=>'baroda')));
echo $this->form->input('profile',array('type'=>'file'));
echo $this->form->end('submit');
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.