controller中:
//修改检测
public function pinpai_modi_check(){
$file[0]=$_FILES['logo']; //对应图片的name
$file[1]=$_FILES['joinpic'];
if(!empty($file[0]['name'])){ //var_dump($file)即可看到键名name
$pic1='./Uploads/'.I('logo1'); //获取原图路径
$pic1=iconv('utf-8','gbk',$pic1); //转换编码,否则中文名文件无法删除
unlink($pic1); //删除之前的图片
}
if(!empty($file[1]['name'])){
$pic2='./Uploads/'.I('joinpic1');
$pic2=iconv('utf-8','gbk',$pic2);
unlink($pic2);
}
$rel=D('pinpai');
$rel->create();
$arr=upload('pinpai');
$rel->logo=$arr[0];
$rel->joinpic=$arr[1];
$rel->save();
$this->success('修改成功!'