[eluser]ELRafael[/eluser]
[quote author="emperius" date="1189082429"]I need to upload few files at the same time.
I made an arrray of input elements
Code:
<table width="700" border="0" cellpadding="5">
<?
for($i=0;$i<5;$i++)
{
echo "<tr>";
echo "<td width=\"200\">Фото ".($i+1)."</td>";
echo "<td width=\"500\"><input type=\"file\" size=\"50%\" name=\"f[$i]\"></td>";
echo "</tr>";
}
?>
<tr>
<td><input type="submit"></td>
<td> </td>
</tr>
</table>
and in the controller I check if field is not empty and try to upload file.
Code:
if(!empty($_FILES['f']))
{
$farr = $_FILES['f'];
for($i=0;$i<count($farr['name']);$i++)
{
if($farr['name'][$i] != "")
{
$field = "f[$i]";
$config['upload_path'] = realpath('public/object');
$config['allowed_types'] = 'jpg';
$this->load->library('upload', $config);
$this->upload->do_upload($field);
$resarr = $this->upload->data();
$file = $resarr['file_name'];
$this->upload->display_errors('<p>', '</p>');
$this->upload->data();
}
}
}
the permission for folder is set 777
and i don't get errors and data about successfull file upload
What I'm doing wrong?[/quote]
teste if the conditions is true... ah! put a / in the line
Code:
$config['upload_path'] = realpath('public/object');
like this:
Code:
$config['upload_path'] = realpath('public/object/');
and try again!