I am getting problem while accessing array in views....
This is the function in controller
public function go()
{
if(isset($_POST['go']))
{
$config['upload_path'] = './uploads/'; /* NB! create this dir! */
$config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
/* Load the upload library */
$this->load->library('upload', $config);
/* We have 3 files to upload
*/
for($i = 1; $i < 4; $i++) {
/* Handle the file upload */
$this->upload->do_upload('files'.$i);
/* Get the data about the file */
$data = $this->upload->data();
$datta = array('upload_data' => $this->upload->data());
echo "<br>";
echo "<br>";
print_r($datta);
}
}
/* And display the result page */
$this->load->view('image_upload_result', $datta);
}
This is my view....
<?php echo form_open_multipart('users/go');?>
<input type="file" name="files1" /><br />
<input type="file" name="files2" /><br />
<input type="file" name="files3" />
<br /><br />
<input type="submit" name="go" value="upload" />
</form>
This is the result page...the function go() uploaded three images but it displays only one record or image....i have tried my best with different methods and loop conditions but in vain....kindly anybody help me...thanks in advance
<?php
foreach($upload_data as $value)
{
print_r($value);
echo "<br>";
echo "<br>";
}
?>
one thing more...the print_r($datta); in the function prints the following
Array ( [upload_data] => Array ( [file_name] => Lighthouse3.jpg [file_type] => image/jpeg [file_path] => C:/wamp/www/CI/uploads/ [full_path] => C:/wamp/www/CI/uploads/Lighthouse3.jpg [raw_name] => Lighthouse3 [orig_name] => Lighthouse.jpg [client_name] => Lighthouse.jpg [file_ext] => .jpg [file_size] => 548.12 [is_image] => 1 [image_width] => 1024 [image_height] => 768 [image_type] => jpeg [image_size_str] => width="1024" height="768" ) )
Array ( [upload_data] => Array ( [file_name] => Koala3.jpg [file_type] => image/jpeg [file_path] => C:/wamp/www/CI/uploads/ [full_path] => C:/wamp/www/CI/uploads/Koala3.jpg [raw_name] => Koala3 [orig_name] => Koala.jpg [client_name] => Koala.jpg [file_ext] => .jpg [file_size] => 762.53 [is_image] => 1 [image_width] => 1024 [image_height] => 768 [image_type] => jpeg [image_size_str] => width="1024" height="768" ) )
Array ( [upload_data] => Array ( [file_name] => Penguins3.jpg [file_type] => image/jpeg [file_path] => C:/wamp/www/CI/uploads/ [full_path] => C:/wamp/www/CI/uploads/Penguins3.jpg [raw_name] => Penguins3 [orig_name] => Penguins.jpg [client_name] => Penguins.jpg [file_ext] => .jpg [file_size] => 759.6 [is_image] => 1 [image_width] => 1024 [image_height] => 768 [image_type] => jpeg [image_size_str] => width="1024" height="768" ) )