Created
September 8, 2015 16:01
-
-
Save vrkansagara/0ace211b43698bc2df4a to your computer and use it in GitHub Desktop.
upload image file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: vallabh | |
* Date: 08/09/15 | |
* Time: 17:34 | |
*/ | |
class Test extends CI_Controller | |
{ | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->load->helper(array('form', 'url')); | |
} | |
public function index() | |
{ | |
$this->load->view('upload_form', array('error' => ' ')); | |
} | |
public function do_upload() | |
{ | |
$this->load->library('upload'); | |
if (!$this->upload->do_upload('userfile')) { | |
$error = array('error' => $this->upload->display_errors()); | |
$this->load->view('upload_form', $error); | |
} else { | |
$data = array('upload_data' => $this->upload->data()); | |
$this->load->view('upload_success', $data); | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment