public function doupload(){ //准备上传返回的结果 $resinfo = array("err"=>"","msg"=>""); import('ORG.Net.UploadFile'); $upload = new UploadFile();// 实例化上传类 $upload->maxSize = 3145728 ;// 设置附件上传大小 $upload->allowExts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型 $upload->savePath = './Uploads/Diary/';// 设置附件上传目录 if(!$upload->upload()) {// 上传错误提示错误信息 $resinfo['err']=$upload->getErrorMsg(); }else{// 上传成功 获取上传文件信息 $info = $upload->getUploadFileInfo(); $resinfo['msg']=__ROOT__."/Uploads/Diary/".$info[0]['savename']; //获取上传的图片名 //执行图片信息的添加 $data['tbname']="notice"; $data['did']=0; $data['picname']=$info[0]['savename']; $data['create_time']=time(); $id = M("Diarypic")->add($data); $_SESSION['diary_img'][]=$id; //保存住当前图片id号 } echo json_encode($resinfo); //通过json形式返回给编辑器 exit(); } 保存路径是"./uploads/diary/"这是相对于当前控制器路径(Home/Lib/Action/DiaryAction)的,但是上传目录Uploads是与控制器的项目目录Home平级的。但是这样是正确的,为何?