搜索

首页  >  问答  >  正文

有没有大佬遇到修改页面 不修改图片 提交后图片没了

    public function edit(){
        $Article=D('Article');
        $Articler=$Article->find(I('id'));
        $this->assign('Articler',$Articler);
        if(IS_POST){
            $date['id']=I('id');
            $date['title']=I('title');
            $date['desc']=I('desc');                        //判断是否有POST方式提交
            $date['pic']=I('pic');
            $date['content']=I('content');
            $date['cateid']=I('cateid');
            if($_FILES['pic']['tmp_name']!=''){
               $upload = new \Think\Upload();// 实例化上传类
               $upload->maxSize   =3145728 ;// 设置附件上传大小
               $upload->exts      =array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
               $upload->rootPath  ='./'; // 设置附件上传根目录
               $upload->savePath  ='./Uploads/'; // 设置附件上传(子)目录
               $info   =   $upload->uploadOne($_FILES['pic']);
               // 上传文件
               if(!$info) {// 上传错误提示错误信息
                    $this->error($upload->getError());
               }else{// 上传成功
                    $date['pic']=$info['savepath'].$info['savename'];
               }
                   
            }else{

            }
             if($文章->create($date)){
               if($Article->save()){
                $this->success("修改文章成功!",U('lst'), 3);
            }else{
                $this->error('修改文章失败!','',3);
            }
            }else{
                $this-> error($Article->getError());

            }
            return;
        }
        $cateres=D('cate')->select();
$this->assign('cateres',$cateres);
        $this->display();
    }  


<tr>
                                <i class="require-red">*</i</th>
                               

                                
                                    <其他/ >
                                   没有必要
                                   
                                    
                                   
                               
                            < ;/tr>

-wy-wy2158 天前1128

全部回复(0)我来回复

暂无回复
  • 取消回复