*Fix* Make upload field required or not required |
[eluser]Unknown[/eluser]
When you don't upload anything an error appeared, (error 4). But not always the upload field is required... So i make some changes to the upload class.... Check this out.... file: system\libraries\Upload.php 1) add this var to the CI_Upload Class (line 29) Code: var $required = 1; 2) add this attribute to the initialization function (line 82) Code: 'required' => 1, 3) add these lines to the do_upload function (line 155) Code: if($this->required == -1 && $_FILES[$field]['tmp_name'] == '') so when you try to upload something from your controller add this to your config Code: $config['required'] = '-1'; by Michalis Tzikas Greece psaxno.com - Create your own search engine |
Welcome Guest, Not a member yet? Register Sign In |