Welcome Guest, Not a member yet? Register   Sign In
Multiple images and data upload
#5

After uploading the files with the library, you can call $this->upload->data();
If you do this:
PHP Code:
$uploaded $this->upload->data(); 
then you have an array containing the metadata of all your uploaded files.

Now, let's assume you have a table in your database, called "uploads" with the fields: id, file_name, file_path, file_size, is_image, image_width, image_height. To store the data of each file as a record in your table, do this:

PHP Code:
foreach ($uploaded as $file) {
 
 $data = array(
 
   'file_name' => $file['file_name'],
 
   'file_path' => $file['file_path'],
 
   'file_size' => $file['file_size'],
 
   'is_image' => $file['is_image'],
 
   'image_width' => $file['image_width'],
 
   'image_height' => $file['image_height']
 
 );
 
 $this->db->insert('uploads',$data);


For a complete list of all file attributes that are in $this->upload->data(), check this page: http://www.codeigniter.com/userguide3/li...ading.html
Reply


Messages In This Thread
Multiple images and data upload - by azharsaleem6 - 02-29-2016, 07:38 AM
RE: Multiple images and data upload - by Wouter60 - 02-29-2016, 01:03 PM
RE: Multiple images and data upload - by Mangetsu - 03-01-2016, 03:37 AM
RE: Multiple images and data upload - by Wouter60 - 03-01-2016, 01:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB