Heim  >  Artikel  >  Backend-Entwicklung  >  帮小弟我看看这个代码,修改功能,无法修改附件。其他正常修改。post方式提交

帮小弟我看看这个代码,修改功能,无法修改附件。其他正常修改。post方式提交

WBOY
WBOYOriginal
2016-06-13 11:58:09799Durchsuche

帮我看看这个代码,修改功能,无法修改附件。其他正常修改。post方式提交
修改功能,无法修改附件。其他正常修改。form表单  ,post方式提交。附件为attachments
  public function do_update(){
            $admin =M('record');
            $id = $_POST['id'];
            $map2['id'] = $id;
            $content= $_POST['content'];
            $map['content'] = $content;
            $title = $_POST['title'];
            $map['title'] = $title;
            //文件上传
            import('ORG.Net.UploadFile');
            $upload = new UploadFile();// 实例化上传类
            $upload->maxSize  = 3145728 ;// 设置附件上传大小
            if($_FILES['attachments']){
                $upload = new UploadFile();// 实例化上传类
                $upload->maxSize  = 3145728000 ;// 设置附件上传大小
                //$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg','txt','doc','doxc','wps','xls','pdf','txt');// 设置附件上传类型
                $upload->savePath =  './Public/Uploads/';// 设置附件上传目录
                $upload->supportMulti = false;
                $upload->autoSub = false;

                $info = $upload->uploadOne($_FILES['attachments']);
                $map['attachments'] = $info[0]['savename'];
            }

            $result=$admin->where($map2)->save($map);
            $this->redirect('__URL__/Admin/admin');
      
    }

------解决方案--------------------
在$result上面打印$map,看一下attachments的值,对应查看表中的字段类型,和长度,这个应该是TP框架,最近没在用,最近在研究CI

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn