Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Admin extends CI_Controller {
- public function __construct()
- {
- parent::__construct();
- $this->load->helper('url');
- $this->load->Model('Mod_admin');
- }
- public function index()
- {
- $this->load->helper(array('form')); //login purposes
- $this->load->view('template/header');
- $data['branches'] = $this->Mod_admin->getAllBranches();
- $this->load->view('index',$data);
- }
- public function account()
- {
- $this->load->view('account', array('error' => ' ' ));
- }
- public function do_upload()
- {
- $config['upload_path'] = './uploads/';
- $config['allowed_types'] = 'gif|jpg|png';
- $this->load->library('upload', $config);
- if ( ! $this->upload->do_upload())
- {
- $error = array('error'=>$this->upload->display_errors());
- $this->load->view('account', $error);
- }
- else
- {
- $data=array('upload_data'=>$this->upload->data());
- $this->load->view('success', $data);
- }
- }
- }//last curly
- <html>
- <body>
- <?php echo form_open_multipart('http://localhost/do_upload');?>
- <input type="file" name="userfile" />
- <br /><br />
- <input type="submit" value="upload" />
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement