Thumbnail upload failed, why?
   伊丽莎白.@芳
 伊丽莎白.@芳 2022-02-08 12:18:59
0
3
1223

Thumbnail upload failed, why?

   伊丽莎白.@芳
 伊丽莎白.@芳

reply all (1)
逆旅行人a

Describe the problem in detail, it is best to paste the code

  • reply public function add(){ $courses=D('courses'); if (IS_POST){ $date['name']=I('name'); $date['descs']=I('descs'); $date['content']=I('content'); $date['cateid']=I('cateid'); $date['update_date']=Date("Y-m-d h:i:s"); $upload->maxSize=5*1024*1024; $upload->exts=array('jpg','gif','png','jpeg'); $upload->rootPath='./Public/'; $upload->savePath='uploads/'; $upload->autoSub = false; if ($_FILES['pic']['name']) { $info=$upload->upload(); if (!$info) { $this->error($upload->getError() ); }else{ $_POST["pic"]=$info["pic"]["savePath"].$info["pic"]["saveName"]; } }else{ $_POST["pic"]="uploads/empty.jpg"; } if ($courses->create($data)){ if($courses->add()){ $this->success('添加课程成功!',U('lst')); }else { $this->error('添加课程失败!'); } }else { $this->error($courses->getError()); } return; } $cateres=D('cate')->select(); $this->assign('cateres',$cateres); $this->display(); } 后台显示图裂开,数据库中图片的路径是上传前图片的路径,如名称.jpg,Public中没有文件上传上去
     伊丽莎白.@芳 author 2022-02-09 10:52:09
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!