私のテーブル構造は以下のようなものです:
============================== ID | 名前 | 画像| ==============================
今、名前で複数の画像を作成したいのですが、どうすればいいですか。
if($this->request->is('post'))
{
if($this->Breakdown->saveAll($this->request->data['Breakdown']))
{
//Image insertion Successfully
$image=$this->request->data['Breakdown'][0]['image1']['name'];
if(!empty($this->request->data['Breakdown'][0]['image1']['name']))
{
$image_path = $this->Image->upload_image_and_thumbnail($image,$this->data['Breakdown'][0]['image1'],600,450,180,120, "Breakdown");
//echo "This".$image_path;
if(isset($image_path))
{
$this->Breakdown->saveField('image',$image_path);
$uploaded = true;
}
}
$this->Session->setFlash('Quantity Breakdown has been added Successfully.', 'default', array('class' => 'oMsg1 oMsgError1'));
$this->redirect('qty_breakdown');
}
else
{
$this->set('errors', $this->Breakdown->invalidFields());
}
複数の画像を挿入してアップロードするためにループを使用する別の方法はありますか?