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

[eluser]Gazzhop[/eluser]
view:
Code:
<?php echo form_open_multipart('image_manager/do_upload');?>
<table>
    <tr>
        <th>Select image you wish to upload</th>
    </tr>
    <tr>
        <td>&lt;?php echo form_upload('userfile');?&gt;</td>
    </tr>
    <tr>
        <td>&lt;?php echo form_submit('submit', 'Upload')?&gt;</td>
    </tr>
</table>

controller

Code:
&lt;?php
class image_manager extends Controller {

    function image_manager()
    {
        parent::Controller();
        $this->load->helper(array('form', 'url'));  
    }
    
    function index()
    {
        
        
        $this->load->helper('directory');
        $map = directory_map(file_url(), TRUE);
        $this->load->view('header');      
  
        $this->load->view('image_manager_view', array('error' => ' ', 'map'=>$map ));
        
        $this->load->view('footer', array("logged_in"=>TRUE));    
    }
    
    function do_upload()
    {
        $config['upload_path'] = 'http://localhost:8888/PDCRARE/images/';
        $config['allowed_types'] = 'gif|jpg|png|bmp';
        $config['max_size'] = '0';
        $config['max_width'] = '0';
        $config['max_height'] = '0';
        $config['overwrite'] = TRUE;
                
        $this->load->library('upload', $config);
        $this->upload->initialize($config);
        if ( ! $this->upload->do_upload('userfile'))
        {
            $error = array('error' => $this->upload->display_errors());
            $this->load->view('header');
            $this->load->view('image_manager_view', $error);
            $this->load->view('footer', array("logged_in"=>TRUE));
            
        }  
        else
        {
            $data = array('upload_data' => $this->upload->data());
          
            $this->load->view('header');
            $this->load->view('image_upload_success', $data);
            $this->load->view('footer', array("logged_in"=>TRUE));
        }
        
        
              
    }  
    
    
    
    
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */
?&gt;

MY_Url_helper

Code:
if ( ! function_exists('file_url'))
{
    function file_url($controller = false)
    {
        if($controller)
           return '../CMS_PDCRARE/images';
        else
           return '../CMS_PDCRARE/images';
    }

PROBLEM:

I keep getting path invalid error, but can't see what i'm doing wrong. Sorry if this is simple noob problem.


Messages In This Thread
Upload problem - by El Forum - 09-18-2009, 08:30 AM
Upload problem - by El Forum - 09-19-2009, 11:29 AM
Upload problem - by El Forum - 09-19-2009, 12:06 PM
Upload problem - by El Forum - 09-21-2009, 04:10 AM
Upload problem - by El Forum - 09-21-2009, 05:12 AM
Upload problem - by El Forum - 09-22-2009, 02:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB