我卡在了,图片上传,看不明白.[解决了]

浏览:647 发布日期:2013/10/18 分类:求助交流 关键字: 图片上传问题
什么时候能出文档呀! 现在问题看不明白图片是如何上传保存到,fz_picture 表中的.又是如何,给fz_document 中 cover_id 字段 ID 值的呢.
这段代码没发现那里处理图片呀!
public function update($data = null){
/* 检查文档类型是否符合要求 */
$res = $this->checkDocumentType( I('type'), I('pid') );
if(!$res['status']){
$this->error = $res['info'];
return false;
}

/* 获取数据对象 */
$data = $this->create($data);
if(empty($data)){
return false;
}
return dump($data);
exit;
/* 添加或新增基础内容 */
if(empty($data['id'])){ //新增数据

$id = $this->add(); //添加基础内容
if(!$id){
$this->error = '新增基础内容出错!';
return false;
}
} else { //更新数据
$status = $this->save(); //更新基础内容
if(false === $status){
$this->error = '更新基础内容出错!';
return false;
}
}

/* 添加或新增扩展内容 */
$logic = $this->logic($data['model_id']);
if(!$logic->update($id)){
if(isset($id)){ //新增失败,删除基础数据
$this->delete($id);
}
$this->error = $logic->getError();
return false;
}

//内容添加或更新完成
return $data;

}
=========================
我搞明白了! OT 的文章里面上传封面图,是使用AJAX ,当点击提交按钮后,执行FileController.class.php uploadPicture() 操作.然后里面有执行了D方法.
$Picture = D('Picture');
$info = $Picture->upload($_FILES, C('PICTURE_UPLOAD')); //TODO:上传到远程服务器
重点还是在PictureModel.class.php 下. 看了就理解了! 感觉稍有麻烦.用了一天的时间,总是搞定了.
最佳答案
评论( 相关
后面还有条评论,点击查看>>