Can someone suggest me how to do next:
I have two database table - 'products' and 'products_photo' I want adding my products to update my products table and information about uploaded photos to be saved into the separated table.
I uploaded photos and the table about products is filled corectly but my table products_photos
is empty.
my controler_product contains
// Custom configuration for this upload
$config = array(
'path' => DOCROOT.DS.'images',
'randomize' => true,
'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'),
);
Upload::process($config);
// if a valid file is passed than the function will save, or if its not empty
if (Upload::is_valid())
{
// save them according to the config
Upload::save();
//if you want to save to tha database lets grab the file name
Model_Products_Photo::add(Upload::get_files());
} // and process any errors
foreach (Upload::get_errors() as $file)
{
// $file is an array with all file information,
// $file contains an array of all error occurred
// each array element is an an array containing 'error' and 'message'
}
And my model products_photo
contains
public static function add($file)
{ print_r($file);
Model_Products_Photo::forge( $file[0]);
}
I assume here in this function is something wrong... I will be thankful for any help.
in is_valid() you give like this.,,