|
发表于 2009-9-2 18:12:27
|
显示全部楼层
本帖最后由 zhoulei 于 2009-9-2 18:13 编辑
10# wrz
可以改改扩展类
.........
$data=array();//返回多个$this->upload->data();
if (count($_FILES[$field]['name']) > 1)
foreach($_FILES[$field]['name'] as $index=>$name)
{
if (!empty($name))
$data[]=$this->do_xupload($field, $index);
}
else
{
parent::do_upload($field);
}
return $data;//把 return true改掉;
........
function do_xupload($field = 'userfile', $index=0)
{
......
return $this->data();
}
CONTROLLER:
$file=$this->upload->do_upload();
$this->create($file);
入库:
function create($file=array())
{
foreach ($file as $upload)
{
$attachment['u_name']=$upload['file_name'];
$attachment['u_type']=$upload['file_type'];
$attachment['u_origname']=$upload['orig_name'];
$attachment['u_ext']=$upload['file_ext'];
$attachment['u_size']=$upload['file_size'];
$attachment['u_isimg']=$upload['is_image'];
$attachment['u_dateline']=date('Y-m-d H:i:s');
$attid=$this->upload_model->create($attachment);//插入数据
$attids[]=$attid;
}
return $attids;
} |
评分
-
查看全部评分
|