• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem Uploading files [SOLVED]

#1
[eluser]lizaaard[/eluser]
i'm having problems with my upload form... can anybody help me.. i've searched the complete forum trying to find an answer.. and i cannot find anything helpful..

here's my controller code:
Code:
<?php
class Upload_files extends Controller {

    function Upload_files(){
        parent::Controller();
        $this->load->helper(array('form', 'url'));
    }
    
    function index(){
        $this->load->view('admin/upload_form', array('error' => ' ' ));
    }
    
    function do_upload()
    {

        $config['upload_path'] = './assets/';
        $config['allowed_types'] = 'gif|jpg|png';
        
        $this->load->library('upload', $config);
    
        if ( ! $this->upload->do_upload())
        {
            $error = array('error' => $this->upload->display_errors());
            
            $this->load->view('admin/upload_form', $error);
        }    
        else
        {
            $data = array('upload_data' => $this->upload->data());
            
            $this->load->view('admin/upload_success', $data);
        }
    }    
}


here's my view file:

Code:
<head>
<title>File Uploads</title>
</head>
<body>
<?php echo $error;?>
<form method="post" action="upload_files/do_upload" enctype="multipart/form-data" />
<input type="file" name="userfile" size="20" />
<br /><br />
&lt;input type="submit" value="upload" /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;


the problem is that the form allways give me this error:

Code:
You did not select a file to upload.

i've tried everything... and i cannot figure how to fix this problem =(

the upload path exists... and the input field it's named userfile...

sorry for my english... i'm from argentina.. and i'm very new at PHP / CI..

thanks for your help =)

#2
[eluser]lizaaard[/eluser]
uhmmmm

i've maded a clean CI installation.. and it works now..
the installation i was using.. has only the HMVC modular extensions installed.. and seems is not working there.. can anyone tell me why???

#3
[eluser]lizaaard[/eluser]
i've fixed... just adding index.php/ into the form multipart target...

i don't know why that happens =)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.