Thanks you very much my friend...!!! I have done the changes & my
problem is solved..!!!

thanks you very much..

friend can you help me in this matter also if you have few minutes for
me..??

I have problem in uploading the image..I want to display the image as
well as store the image in database...
I mean to say these are my files:

add.ctp:
<h1>Add User</h1>


<?php
 echo $form->create('User', array('action' => '/add/
index','enctype'=>'multipart/form-data'));
echo  $form->input('name');
echo $form->input('address', array('rows' => '3'));
echo $form->input('phone');
echo $form->input('mobile');
echo $form->input('email');
echo $form->input('city');
echo $form->input('state');
echo $form->input('image',array('type' => 'file'));
echo $form->end('Save User');
?>



This is my controller file:

<?php
class UsersController extends AppController {

        var $name = 'Users';
        var $layout='user';

        var $paginate = array(
        'limit' => 4,
        'order' => array(
            'User.name' => 'asc'
        )
    );


        function index() {
                //$this->set('users', $this->User->find('all'));
                $data = $this->paginate('User');
          $this->set(compact('data'));
        }

        function view($id) {
                $this->User->id = $id;
                $this->set('user', $this->User->read());

        }

        function delete($id) {
        $this->User->del($id);
$this->flash('The user with id: '.$id.' has been deleted.', 'http://
192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
}

        function add() {
                if (!empty($this->data)) {


                                $this->flash('Your detail has been 
saved.','http://192.168.0.60/
vishal/cake_1.2.0.6311-beta/app/users/index');
                        }

                }


        function edit($id = null) {
        $this->User->id = $id;
        if (empty($this->data)) {
                $this->data = $this->User->read();
        } else {
                if ($this->User->save($this->data['User'])) {
                        $this->flash('Your detail has been updated.', 
array('action' =>
'index'));
                }
        }
}

}
?>


the problem is that I want to store the image path in database field &
I want to dispaly the image at front end...i.e where the images are go
in which folder ????
the path is saved by using above code....
have you got my issue ??

thanks,
vishal


On May 20, 2:42 pm, djiize <[EMAIL PROTECTED]> wrote:
> it's due to Cake routing and URL rewriting
> in some cases, prefer HTML helper instead your own HTML
>
> in your layout, change
> <link href="../../app/webroot/css/style.css" rel="stylesheet"
> type="text/css" />
> by
> <?php echo $html->css('style') ?>
>
> and change al
> <IMG SRC="../../app/webroot/img/your_image.gif"  >
> by
> <?php echo $html->image('your_image.gif') ?>
>
> And last, in your "flash" calls, don't repeat the host, path, etc...
> just do:
> $this->flash('Your detail has been updated.', '/users/index');
> or better, as you already are in Users controller (and you'll get
> others benefits, as reverse routing):
> $this->flash('Your detail has been updated.', array('action' =>
> 'index'));
>
> On 20 mai, 10:33, vishal <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >      Myself vishal facing a problem while editing.when i edit the
> > layout changes. so anybody help me please..
> > But in case of add it look well.
> > This is the details of the file:
>
> > Layout file:
>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> > <head>
> > <title><?php echo $title_for_layout?></title>
> > <link href="../../app/webroot/css/style.css" rel="stylesheet"
> > type="text/css" />
>
> > </head>
> > <body>
>
> > <table width='900px'>
> >         <tr>
> >                         <td colspan='2'>
> >                                 <table width='100%'>
> >                                         <tr>
> >                                                 <td colspan='3' 
> > align='right'><div>Home| Our Company| Sitemap|
> > Projects</div></td>
> >                                         </tr>
> >                                         <tr>
> >                                                 <td width="33%" 
> > align="center"><IMG SRC="../../app/webroot/img/
> > logo.gif"  ></td>
> >                                                 <td width="35%" 
> > align="center"><IMG SRC="../../app/webroot/img/
> > logo01.gif"  ></td>
> >                                                 <td align="center"><IMG 
> > SRC="../../app/webroot/img/logo.gif"  ></
> > td>
> >                                         </tr>
> >                                 </table>
>
> >                         </td>
> >         </tr>
> >         <tr valign="top">
> >                 <td width='20%'>
> >                                 <table width='100%' cellpadding="3" 
> > cellspacing="3" border="0"
> > align="center">
> >                                         <tr><td class="sitemap" ><?php echo 
> > $html->link('User', 'http://
> > 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index'); ?></td></
> > tr>
> >                                         <tr><td class="sitemap" ><?php echo 
> > $html->link('Messages',
> > 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> > index'); ?></td></tr>
> >                                         <tr><td class="sitemap" ><?php echo 
> > $html->link('Account',
> > 'http://192.168.0.60/vishal/cake_1.2.0.6311-beta/app/messages/
> > index'); ?></td></tr>
> >                                 </table>
> >                 </td>
> >                 <td width='80%'>
> >                                 <?php  echo $content_for_layout ?>
>
> >                 </td>
> >         </tr>
> >         <tr>
> >                         <td colspan='2'>
> >                                 <div id="footer" >contactus| About us| 
> > privacy policy</div>
> >                         </td>
> >         </tr>
> > </table>
> > </body>
> > </html>
>
> > This is my controller page:
>
> > <?php
> > class UsersController extends AppController {
>
> >         var $name = 'Users';
> >         var $layout='user';
>
> >         var $paginate = array(
> >         'limit' => 4,
> >         'order' => array(
> >             'User.name' => 'asc'
> >         )
> >     );
>
> >         function index() {
> >                 //$this->set('users', $this->User->find('all'));
> >                 $data = $this->paginate('User');
> >           $this->set(compact('data'));
> >         }
>
> >         function delete($id) {
> >         $this->User->del($id);
> > $this->flash('The user with id: '.$id.' has been deleted.', 'http://
> > 192.168.0.60/vishal/cake_1.2.0.6311-beta/app/users/index');
>
> > }
>
> >         function add() {
> >                 if (!empty($this->data)) {
> >                         if ($this->User->save($this->data)) {
> >                                 $this->flash('Your detail has been 
> > saved.','http://192.168.0.60/
> > vishal/cake_1.2.0.6311-beta/app/users/index');
> >                         }
>
> >                 }
> >         }
>
> >         function edit($id = null) {
> >         $this->User->id = $id;
> >         if (empty($this->data)) {
> >                 $this->data = $this->User->read();
> >         } else {
> >                 if ($this->User->save($this->data['User'])) {
> >                         $this->flash('Your detail has been 
> > updated.','http://192.168.0.60/
> > vishal/cake_1.2.0.6311-beta/app/users/index');
> >                 }
> >         }
>
> > }
> > }
>
> > ?>
>
> > & this is my edit.ctp view file:
> > <h1>Edit User</h1>
>
> > <?php
> > echo $form->create('User', array('action' => 'edit'));
> > echo  $form->input('name');
> > echo $form->input('address', array('rows' => '3'));
> > echo $form->input('phone');
> > echo $form->input('mobile');
> > echo $form->input('email');
> > echo $form->input('city');
> > echo $form->input('state');
> > echo $form->input('image',array('type' => 'file'));
> > echo $form->end('Save User');
> > ?>
>
> > I am using the same layout in case of add & edit...but in case of edit
> > it looks differentt without images that i use in layout file...so plz
> > help me as soon as possible...!!!!
> > I m waiting for the reply..!!!
>
> > vishal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to