在Cakephp中从数据库编辑期间如何删除图像? [英] How Can I Delete Image During Edit From Database In Cakephp?

查看:99
本文介绍了在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;


这篇关于在Cakephp中从数据库编辑期间如何删除图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆