0

this is my controller function and below is my view file code pleas help to find out the error in my code

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Upload extends CI_Controller {

    function __construct(){
        parent::__construct();
    }


    function test(){
        if($this->input->post('submit')){
            $config['upload_path'] = $_SERVER['DOCUMENT_ROOT'].'/assets/uploads/';
            $config['allowed_types'] = 'mp4';
             $this->load->library('upload',$config);

            if ( ! $this->upload->do_upload()){
                $error = array('error' => $this->upload->display_errors());
            }else{
                $data = array('upload_data' => $this->upload->data());
            }
        }   
        $this->load->view('upload/test');
    }

}
?>

and this is my view code->

<form action="" method="POST" enctype="multipart/form-data" >
    Select File To Upload:<br />
    <input type="file" name="userfile"  />
    <br /><br />
    <input type="submit" name="submit" value="Upload" class="btn btn-success" />
</form>

and i m getting errors are -> enter image description here

1
  • its clearly says that it not able to load the upload library. You need to check that your upload library is available to load in controller or not. Commented Mar 10, 2015 at 14:22

1 Answer 1

1

Finally i got this working,it took whole day. I was developing this on CI version->3.0 and when i replace my system folder with the new updated CI VERSION->3.0rc2 it worked like a charm in a single go and didn't change a single line in the above code.Both are development version of CI-3.But in the updated version my form validation stopped working, but as in the last version it was working fine so i copied my old version system/library/form_validation.php to new version at the same place and it is working fine now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.