Good evening guys, I got a problem in my code. I'm doing a gallery form with separate fields.
I'm always end up with a "none" output because it does not get my input even though I entered something in the thumbnails[] field.
Anyone got an idea on how can I manage to fix it and how can it be done. Thank you very much.
Here is my code in html:
Main Image:
<input type="file" name="file1" required/>
Thumbnails:
<input type="file" name="thumbnails[]" />
<input type="file" name="thumbnails[]" />
<input type="file" name="thumbnails[]" />
In my Controller:
$config = array(
'upload_path' => "./uploads/workplace/",
'allowed_types' => "jpg|png|jpeg",
'remove_spaces' => TRUE,
'max_size' => "2048000", // Can be set to particular file size , here it is 2 MB(2048 Kb)
'max_height' => "0",
'max_width' => "0"
);
$this->load->library('upload', $config);
if($this->upload->do_upload('file1'))
{
$config = array(
'upload_path' => "./uploads/workplace/",
'allowed_types' => "jpg|png|jpeg",
'remove_spaces' => TRUE,
'max_size' => "2048000", // Can be set to particular file size , here it is 2 MB(2048 Kb)
'max_height' => "0",
'max_width' => "0"
);
$this->load->library('upload', $config);
if($this->upload->do_upload('thumbnails[]'))
{
echo "yea";
}
else
{
echo "none";
}
}