• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with insert upload file

#1
i have problem with my implode function when i try to insert just one line with come it always store many lines need helps this is my code 


$config["upload_path"]   = $this->upload_path;
$config["allowed_types"] = "jpg|jpeg|png|gif";
$config['file_name'] = $_FILES['file']['name'];


$files = [];
$ids = '';
foreach ($_FILES as $key => $value) {
if (!empty($value['name'])) {
   $this->load->library('upload', $config);
                if (!$this->upload->do_upload($key)) {
                    echo "failed to upload file(s)";
                }
                else{
$fileData = $this->upload->data();
//$files[$i] = $this->upload->data();
//$file [] = $files[$i]['file_name'];
$files[] = $fileData['file_name'];
//$file = $dir_path . $files[$i]['file_name'];
//++$i;
}
}
}
if(is_array($files)){
$ids = implode(',', $files);
$this->db->set('image', implode(', ',$files));
$this->db->insert('annonce');
}
Reply


Messages In This Thread
problem with insert upload file - by Abdoul Aziz - 11-14-2016, 05:50 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.