【发布时间】:2015-08-26 05:48:36
【问题描述】:
我需要将单个图像文件上传到多个路径。我尝试了很多方法。但我失败了。请帮助我克服这一点。
我的代码如下所示:
$config['upload_path'] = './img/post_images/family/';
$config['allowed_types'] = 'gif|jpg|png|jpeg|';
$this->load->library('upload', $config);
$this->upload->initialize($config);
$field_name ="img_fld";
$rgpic="0";
if ( !$this->upload->do_upload($field_name))
{
$error = $this->upload->display_errors();
$data['error']=$error;
}
else
{
$data = $this->upload->data();
$regpicname=$data['file_name'];
$rgpic="1";
}
if($rgpic!=0)
{
$data = array(test_img'=>'img/'.$regpicname,
);
}
$query = $this->db->insert('images',$data);
我需要将相同的图像上传到另一个目录。请帮我 。提前致谢。
【问题讨论】:
-
使用
copy()function。
标签: image codeigniter image-uploading