Welcome Guest, Not a member yet? Register   Sign In
Can't upload file
#3

[eluser]ArifBD[/eluser]
i have simply use the code from the following page.... and yes i have created a folder name "uploads" in root directory and as it was not working i also created same folder in the application directory.
http://ellislab.com/codeigniter/user-gui...ading.html

Controller:
upload.php
Code:
<?php

class Upload extends CI_Controller {

function __construct()
{
  parent::__construct();
  $this->load->helper(array('form', 'url'));
                //$this->document_path= realpath(APPPATH.'../uploads');
}

function index()
{
  $this->load->view('upload_form', array('error' => ' ' ));
                
}

function do_upload()
{
  //$config['upload_path'] = $this->document_path;
                $config['upload_path'] = './uploads/';
  $config['allowed_types'] = 'gif|jpg|png';
  $config['max_size'] = '100';
  $config['max_width']  = '1024';
  $config['max_height']  = '768';

  $this->load->library('upload', $config);
                
  if ( ! $this->upload->do_upload())
  {
   $error = array('error' => $this->upload->display_errors());
                        $data = array('upload_data' => $this->upload->data());
   $this->load->view('upload_form', $error,$data);
  }
  else
  {
   $data = array('upload_data' => $this->upload->data());

   $this->load->view('upload_success', $data);
  }
}
}
?>


Messages In This Thread
Can't upload file - by El Forum - 10-16-2012, 02:52 AM
Can't upload file - by El Forum - 10-16-2012, 03:09 AM
Can't upload file - by El Forum - 10-16-2012, 04:18 AM
Can't upload file - by El Forum - 10-16-2012, 04:34 AM
Can't upload file - by El Forum - 10-16-2012, 04:45 AM
Can't upload file - by El Forum - 10-16-2012, 04:58 AM
Can't upload file - by El Forum - 10-16-2012, 05:02 AM
Can't upload file - by El Forum - 10-16-2012, 05:28 AM
Can't upload file - by El Forum - 10-16-2012, 07:17 AM
Can't upload file - by El Forum - 10-16-2012, 07:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB