I am new in CakePHP. I want to store the products and product details
with image (image will be store in folder, not in table).

Here is my code details:
categories Table:

`categoryId` int(10) NOT NULL auto_increment,
  `categoryName` varchar(100) NOT NULL,
  `isActive` enum('Y','N') NOT NULL default 'Y',
  PRIMARY KEY  (`categoryId`)

products Table:

`productId` int(10) NOT NULL auto_increment,
  `productName` varchar(20) NOT NULL,
  `categoryId` int(10) NOT NULL,
  `productImage` varchar(40) NOT NULL,
  `isActive` enum('Y','N') NOT NULL default 'Y',
  PRIMARY KEY  (`productId`)

It is my product Model

class product extends AppModel
{
 var $name = 'Product';
 var $primaryKey = 'productId';
 var $validate = array(
       'productName'  => VALID_NOT_EMPTY,
   );

 var $belongsTo = array(
        'Category' => array(
            'className'  => 'category',
            'foreignKey' => 'categoryId',
        )
    );

}

and it is my category model:

class category extends AppModel
{
 var $name = 'Category';
 var $primaryKey = 'categoryId';
 var $validate = array(
       'categoryName'  => VALID_NOT_EMPTY,
   );

}

Product Controller:

function admin_add()
{
  if (!empty($this->data['Product']))
  {
        if ($this->Product->save($this->data))
          $this->flash('Your Product has been added.','../products/',
5);
  }

}

I want to introduce the image upload functionality with it. I have
gone thu a few articles on cakephp upload file, become more confused.
Is there any easy way to do it? Is there any in-built helper for this
type of functionality? Please help me.
--~--~---------~--~----~------------~-------~--~----~
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