Welcome Guest, Not a member yet? Register   Sign In
Upload class problem
#1

[eluser]emperius[/eluser]
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">
    &lt;?
        for($i=0;$i<5;$i++)
        {
            echo "<tr>";
                echo "<td width=\"200\">Фото ".($i+1)."</td>";
                echo "<td width=\"500\">&lt;input type=\"file\" size=\"50%\" name=\"f[$i]\"&gt;</td>";
            echo "</tr>";
        }
    ?&gt;
    <tr>
      <td>&lt;input type="submit"&gt;</td>
      <td>&nbsp;</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 Sad

What I'm doing wrong?


Messages In This Thread
Upload class problem - by El Forum - 09-06-2007, 01:40 AM
Upload class problem - by El Forum - 09-06-2007, 02:55 AM
Upload class problem - by El Forum - 09-06-2007, 02:58 AM
Upload class problem - by El Forum - 09-10-2007, 04:41 AM
Upload class problem - by El Forum - 09-11-2007, 01:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB