【发布时间】:2016-10-22 12:51:47
【问题描述】:
我一直在尝试使用 codeigniter 文件上传库上传多张图片。一切正常,只是没有将图像保存在目录中, 我有检查权限,一切都很完美。我也尝试过更换包装,但仍然面临同样的问题。
这是我的上传代码。
$count = count($_FILES['upload_' . $increment]['size']);
for ($s = 0; $s <= $count-1; $s++) {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = '10000';
$config['max_width'] = '2048';
$config['max_height'] = '1152';
$image = $config['file_name'] = $c_id . '-' . $s . '.jpg';
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->upload->do_upload();
$data = $this->upload->data();
$data = array('c_id' => $c_id, 'image'=> $image);
$this->db->insert('images', $data);
}
$increment++;
【问题讨论】:
-
也许这会起作用
$config['upload_path'] = './assets/uploads/'; -
我在父目录中有上传文件夹
-
好吧,比从路径中删除点
-
已经试过了。
-
请找出上传错误。 $this->upload->display_errors()
标签: php codeigniter