我这里有一个问题,我在opencart上构建了一个简单的多重上传功能,文件保存在文件夹但不保存路径n mysql,谁能帮助我,
看法 :
<input type="file" name="picture[]" accept="img/*" />
<input type="file" name="picture[]" accept="img/*" />
控制器 :
foreach ($this->request->files['picture']['error'] as $key => $error) {
$tmp_name = $this->request->files['picture']['tmp_name'][$key];
$this->request->post['img'] = "test/".$this->request->files['picture']['name'][$key];
move_uploaded_file($tmp_name,DIR_IMAGE .$this->request->post['img']);
}
模型 :
$this->db->query("INSERT INTO " . DB_PREFIX . "product_image SET image = '" . $this->db->escape($data['img']) . "',product_id = '" . (int)$product_id . "'");