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

Does $file contain the the path or just the file name ?
Get_file_info need the path as well as the file name.
You might be better of using just the file helper.


PHP Code:
$this->load->helper('file');
 
   
    $files 
get_filenames('./images/gallery/',TRUE); //TRUE to include the path with the file name
 
   
    foreach
($files as $file) {
 
       
        $get_info 
get_file_info($file);
 
       
        $data 
= array( 
 
           'category' => 'uncategorised',
 
           'image_name' => $get_info['name'],
 
           'alt' => $get_info['name'],
 
           'full_path' => $get_info['server_path'],
 
           'image_width' => '800',
 
           'image_height' => '600'
 
       );
 
       $this->add_content($data'gallery_images'); 

But I am not sure if this will include sub-folder. you will need to do a var_dump be sure.
Have a look at the helpers documentation to see what is available.
A good decision is based on knowledge and not on numbers. - Plato

Reply


Messages In This Thread
RE: Trying to put info from files into database - by salain - 09-29-2016, 05:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB