Welcome Guest, Not a member yet? Register   Sign In
File upload not working
#1

[eluser]learning_php[/eluser]
Hi,

i had an image upload function working on my localhost but when i put in on the server it gives me a error:

Code:
The upload path does not appear to be valid.
]
controller
Code:
function upload()
    {
        // Image configuration
        $config['upload_path'] = 'uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['overwrite'] = FALSE;
        $config['max_size'] = 4048;
        
        $this->load->library('upload', $config);
        
    
        if(!$this->upload->do_upload())
        {
            $error = array('error' => $this->upload->display_errors());
            $this->load->view('upload', $error);
        }
        else
        {
            
        
            $image = $this->upload->data();
            $data['image'] = "uploads/".$image['file_name'];
            
            $config['image_library'] = 'gd2';
            $config['source_image'] = $data['image'];
            $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 150;
            $config['height'] = 150;
            $config['new_image'] = "thumbs/".$image['file_name'];
            
            $this->load->library('image_lib', $config);
            
            $this->image_lib->resize();
            
            $data = array('upload_data' => $this->upload->data());
            
            $this->load->view('upload_suc', $data);
            
        }
    }

view
Code:
<!DOCTYPE HTML>
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Uploader&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
     &lt;?= form_open('gallery/logout')?&gt;
        &lt;input type="submit" value="Logout" /&gt;
    &lt;?=form_close();?&gt;
    &lt;?php echo $error;?&gt;

    &lt;?php echo form_open_multipart('uploadimg/upload');?&gt;

    &lt;input type="file" name="userfile" size="20" /&gt;
    <br /><br />

    &lt;input type="submit" value="upload" /&gt;

    &lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
File upload not working - by El Forum - 05-12-2009, 07:05 AM
File upload not working - by El Forum - 05-12-2009, 07:08 AM
File upload not working - by El Forum - 05-12-2009, 07:14 AM
File upload not working - by El Forum - 05-12-2009, 07:22 AM
File upload not working - by El Forum - 05-12-2009, 07:30 AM
File upload not working - by El Forum - 05-12-2009, 07:34 AM
File upload not working - by El Forum - 05-12-2009, 08:03 AM
File upload not working - by El Forum - 05-12-2009, 09:38 AM
File upload not working - by El Forum - 05-12-2009, 09:56 AM
File upload not working - by El Forum - 03-30-2010, 12:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB