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

(This post was last modified: 02-15-2017, 01:34 AM by wolfgang1983.)

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
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#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
#3

(02-14-2017, 11:48 PM)pdthinh Wrote:
(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

I set this to

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

I should be no limit / unlimited but not.
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#4

Hi,

Are you sure your php.ini has been loaded?
You can try to add it to your .htaccess file like this:
php_value upload_max_filesize 64M
php_value post_max_size 64M
A good decision is based on knowledge and not on numbers. - Plato

Reply




Theme © iAndrew 2016 - Forum software by © MyBB