Welcome Guest, Not a member yet? Register   Sign In
Trying to put info from files into database
#1

Hi there,

I am trying to scan through a specific folder (which will have images in) and for each one get the information and add them into a database.  These files will already be uploaded onto the server so this is to be able to rebuild the information in the table.

PHP Code:
$this->db->truncate('gallery_images');

 
   $this->load->library('upload');
 
   $files scandir(base_url().'public/images/gallery/');
 
   foreach($files as $file) {
 
       $this->upload->do_upload($file);
 
       $this->session->set_flashdata('success_message'$this->upload->data('file_name'));
 
       $data = array( 
 
           'category' => 'uncategorised',
 
           'image_name' => $this->upload->data('file_name'),
 
           'alt' => $this->upload->data('file_name'),
 
           'full_path' => $this->upload->data('full_path'),
 
           'image_width' => $this->upload->data('image_width'),
 
           'image_height' => $this->upload->data('image_height')
 
       );
 
       $this->add_content($data'gallery_images');

 
   }

 
   redirect('admin/gallery/gallery_images'); 

I have tested it and I know that it's not finding any files but I don't know why.

Thanks,

Doomie22
Reply


Messages In This Thread
Trying to put info from files into database - by doomie22 - 09-28-2016, 07:58 PM



Theme © iAndrew 2016 - Forum software by © MyBB