Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to upload file in Codelgniter

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 85
    Comment on it

    Hello Friends,

    File uploading is very basic component of web-development. If you are new in Codelgniter and want to code for file uploading please follow the below code:

    //Configure set the path where the files uploaded will be copied. Make sure folder have permission 777
    $config['upload_path'] = 'public/uploads/festivals/';
    
     // set the filter image types
    $config['allowed_types'] = 'gif|jpg|png|jpeg';
    
     //load the upload library
     $this->load->library('upload', $config);
     $this->upload->initialize($config);
    
    //if not successful, set the error message
    if ($this->upload->do_upload()) {
     echo "upload successfully";
    }else{
     echo $error = array('error' => $this->upload->display_errors());
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: