Welcome Guest, Not a member yet? Register   Sign In
max_size 0 no limit not working
#2

(02-14-2017, 07:58 PM)wolfgang1983 Wrote: I get this error when upload image

The uploaded file exceeds the maximum allowed size in your PHP configuration file.

How can I in crease can some one tell me where to place it or how to fix it?


PHP Code:
$config['max_size'] = 0

 
Code:
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

PHP Code:
public function upload_attachments() {
 
$data = array();

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

 
$upload_data $this->upload->data();

 
$user_id '1';
 
$post_code $this->input->post('post_code');
 
$file_code random_string('alpha'32);
 
$file_name $_FILES['attachment']['name'];
 
$ext pathinfo($file_namePATHINFO_EXTENSION);
 
$date date('Ym');
 
$upload_path FCPATH 'uploads/';

 if (!
is_dir($upload_path $date)) {
 @
mkdir($upload_path $date);
 }

 
$config['upload_path'] = $upload_path $date;
 
$config['file_name'] = 'post_' time() . '_' $file_code;
 
$config['allowed_types'] = 'jpg|png|php|js|html|pdf|css|xml';
 
$config['max_size'] = 0;
 
$config['max_width'] = 0;
 
$config['max_height'] = 0;
 
$config['overwrite'] = TRUE;

 
$this->upload->initialize($config);

 if (!
$this->upload->do_upload('attachment')) {
 
 
$data['upload_errors'] = $this->upload->display_errors();
 
$data['success'] = false;

 
       } else {

 
        $this->load->model('catalog/forum/attachment_model');

 
        if ($this->attachment_model->check_if_code_set($this->input->post('code'))) { 

 
        } else {

 
        $upload_data $this->upload->data();

 
        $data['info'] = $this->upload->data();

 
        $this->attachment_model->new_attachment($post_code$user_id$upload_data);
 
        }

 
        //$data['files'] = $this->newthread_model->get_attachments($post_code);

 
        $data['success'] = true;
 
  }

 echo 
json_encode($data);
 } 


I created a php.ini file and added this

Bud does not change any thing still get error

php.ini is configuration file of PHP, not CI. If you use XAMPP, it location may be c:/xampp/php
Reply


Messages In This Thread
max_size 0 no limit not working - by wolfgang1983 - 02-14-2017, 07:58 PM
RE: php.ini codeigniter - by pdthinh - 02-14-2017, 11:48 PM
RE: php.ini codeigniter - by wolfgang1983 - 02-15-2017, 12:25 AM
RE: max_size 0 no limit not working - by salain - 02-15-2017, 02:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB