manjusha
manjusha

Reputation: 123

the file you are attempting to upload is larger than the permitted size ,error during file uploading

I want to upload a file of size 2.89KB. When i upload the file, then error is

The file you are attempting to upload is larger than the permitted size.

Here is my code for reference.

$config['upload_path'] = './uploads/';
            $config['allowed_types'] = 'gif|jpg|png|xls';
            $config['max_size'] = '';
            $config['max_width']  = '';
            $config['max_height']  = '';

            $this->load->library('upload', $config);

            if (!$this->upload->do_upload())
            {
                $error = array('error' => $this->upload->display_errors());

                $this->load->view('uploadstatement',$error);
            }
            else
            {
    $data = array('upload_data' => $this->upload->data());
    $data1=$this->upload->data();
    $file=$data1['file_name'];

Upvotes: 0

Views: 7147

Answers (2)

illeas
illeas

Reputation: 320

Try to double check your php.ini this following:

upload_max_filesize=2M 
post_max_size=8M

replace

upload_max_filesize=250M 
post_max_size=350M

or

if(isset($_FILES["filename"]['name'])){
  $config['upload_path']          = './uploads/';
  $config['allowed_types']        = '*';
  $config['max_size']             = 204800;
  $config['encrypt_name'] = TRUE;
  $new_name = time().$_FILES["filename"]['name'];
  $config['filename'] = $new_name;
  $this->upload->initialize($config);
  $this->load->library('upload', $config);
  $this->upload->do_upload('filename');
  $new_filename=$this->upload->data('file_name');
}

Upvotes: 0

Grald
Grald

Reputation: 464

Try to double check your php.ini this following:

"/xampp/php/php.ini" //in your xampp folder

upload_max_filesize=2M
post_max_size=8M

Upvotes: 3

Related Questions