0
我需要將單個圖像文件上載到多個路徑。我嘗試了很多方法。但我失敗了。請幫我解決這個問題。如何使用codeigniter中的多個路徑上載單個文件
我的代碼如下所示:
$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](http://php.net/manual/ EN/function.copy.php)。 – Tpojka