[eluser]ludo31[/eluser]
hello , I would like to know how to upload several images at the same time , I know for one image and I can store it in database !! but my project is about shoes :
each chose have identifier (id_chaussure ) and we can attach it several images : so here is my viex file where we download image
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Bienvenue dans l'Image</title>
</head>
<body>
<h1>Bienvenue dans l'Image des chaussures </h1>
<?php
// here the id_shoes
if(isset($identifiant_chaussure))
{
echo 'identifiant:'.$identifiant_chaussure ;
}
?>
<?php echo form_open_multipart('site/do_upload'); ?>
<?php echo form_label('Identifiant', 'chaussure'); ?><br/>
<?php echo form_input('identifiant', $identifiant_chaussure); ?><br/>
<input type="file" name="userfile" size="20" /> <br/>
<?php echo form_button('ajouter','Ajouter'); ?>
<?php echo form_submit('envoi', 'Envoyer'); ?>
<?php echo form_close(); ?>
</body>
</html>
I add a button in order to add other upload form so when we click on it another
<input type="file" name="userfile" size="20" /> <br/>
must show .
Code:
<?php echo form_button('ajouter','Ajouter'); ?>
and my last question how to get after ??
in my controller
Code:
$identifiant_chaussure = $this->input->post('identifiant');
// echo ('identifiant '.$identifiant_chaussure) ; exit ;
$config['upload_path'] = './image/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$config['encrypt_name'] = true ;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('image_view', $error);
}
else
{
// $data = array('upload_data' => $this->upload->data());
$data = $this->upload->data();
// print_r($data);exit ;
$this->load->view('upload_success', $data);
}
thanks