[eluser]Unknown[/eluser]
Hi,
I try to use the function do_upload.
I have created the following code:
Code:
$config['upload_path'] = './upload/';
$config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';
$config['max_size'] = '0';
$config['max_width'] = '0';
$config['max_height'] = '0';
$this->load->library('upload', $config);
$configThumb['image_library'] = 'gd2';
$configThumb['source_image'] = '';
$configThumb['create_thumb'] = TRUE;
$configThumb['maintain_ratio'] = TRUE;
$configThumb['width'] = 140;
$configThumb['height'] = 210;
$this->load->library('image_lib');
for($i = 1; $i < 6; $i++)
{
if($_FILES['photo'.$i]['error'] == 0)
{
$upload = $this->upload->do_upload('photo'.$i);
if($upload === true)
{
$data_file = $this->upload->data();
if($data_file['is_image'] == 1)
{
$configThumb['source_image'] = $data_file['full_path'];
$this->image_lib->initialize($configThumb);
$this->image_lib->resize();
$this->image_lib->clear();
}
}
}
}
This code upload my files in the directory but the name of the images aren't correct. For information, I use this kind of form:
Code:
...
<input type="file" name="photo1" />
<input type="file" name="photo2" />
<input type="file" name="photo3"/>
<input type="file" name="photo4" />
<input type="file" name="photo5" />
...
For example, I upload the file 0000.jpg and 0001.jpg.
Result in my directory upload: 0000.jpg, 0000.jpg.jpg, 0000.jpg_thumb.jpg, 0000_thumb.jpg.
I don't understand why the file is renaming and how?
The second file use the name of the first with extension...
Thanks in advance for your help.