在Cakephp中从数据库编辑期间如何删除图像?
问题描述:
控制器部分
controller part
public function delete1($id) {
$this->Form->id = $id;
$this->Form->delete($this->request->data('Form.image'));
$this->Session->setFlash('Image remove successfully');
}
in edit.ctp
in edit.ctp
echo $this->Html->image('/app/webroot/images/small/thumb_' . $ceck['Form']['image'],array('alt'=>'apple','width'=>'70px','height'=>'50px')) ;
echo "<br>";
echo $this->Html->link($this->Html->image('delete.png', array('alt' => 'Delete','title' => 'Delete')), array( 'controller' => 'forms','action' => 'delete1',$ceck['Form']['id'] ), array( 'escape' => false, 'confirm' => 'Are you sure you want to delete?' ));
}
答
id){
this-> Form-> ; id =
this->Form->id =
id;