codeigniter-3

How to display disallowed file type error message in case of upload in Codeigniter 3?

大憨熊 提交于 2020-06-13 00:15:20
问题 I am working on a basic blog application with Codeigniter 3.1.8 and Bootstrap 4 . The posts, of course, have main images. There is a default image if no image is uploaded by the user but, if an image is uploaded, there are only 3 types allowed : jpg, jpeg and png. Wanting to warn the user in case she/he tries to upload other file formats, I did this in the Posts controller: // Upload image $config['upload_path'] = './assets/img/posts'; $config['allowed_types'] = 'jpg|jpeg|png'; $config['max

How to submit the dynamical input field into the database?

主宰稳场 提交于 2020-05-14 03:53:25
问题 I am displaying the input field dynamically which is working for me. The issue is, I have to submit the form. I have tried some code as below but it's not working. I am using Codeigniter. Controler code public function register(){ $save = array( 'pp_fileStatus' => $this->input->post('pp_fileStatus'); 'reasonDate' => $this->input->post('reasonDate'); 'reasonAmt' => $this->input->post('reasonAmt'); ); $afterxss=$this->security->xss_clean($save); if ($afterxss) { $this->db->insert('tbl_register'

What is the cause of this wrong image upload error message in my Codeigniter 3 application?

拟墨画扇 提交于 2020-05-01 06:42:51
问题 I am working on a basic blog application with Codeigniter 3.1.8 and Bootstrap 4 . There is, among others an "Edit account information" form, which has an image upload field. In the controller, the update() method contains the logic for the image upload action: public function update() { // Only logged in users can edit user profiles if (!$this->session->userdata('is_logged_in')) { redirect('login'); } $id = $this->input->post('id'); $data = $this->Static_model->get_static_data(); $data['pages

CI new default controller not working

試著忘記壹切 提交于 2020-04-30 04:59:47
问题 Have problem with CI 3.0 if i leave default controller in routes.php file "welcome" everything is working perfectly. BUT if I change it i.e. "main" CI starts to throw 404 error main controller for first steps is the same as welcome. I just copied files. renamed, changed class name (ofcourse), and in index() loading view. any suggestions? also I forgot to tell on wamp localhost everything is working.. but in server NOT.. :/ And one more thing... i.e. if I try go to mydomain.com/welcome -

CI new default controller not working

本秂侑毒 提交于 2020-04-30 04:59:26
问题 Have problem with CI 3.0 if i leave default controller in routes.php file "welcome" everything is working perfectly. BUT if I change it i.e. "main" CI starts to throw 404 error main controller for first steps is the same as welcome. I just copied files. renamed, changed class name (ofcourse), and in index() loading view. any suggestions? also I forgot to tell on wamp localhost everything is working.. but in server NOT.. :/ And one more thing... i.e. if I try go to mydomain.com/welcome -

Message: call_user_func_array() expects parameter 1 to be a valid callback

爷,独闯天下 提交于 2020-04-11 04:37:11
问题 A PHP Error was encountered Severity: Warning Message: call_user_func_array() expects parameter 1 to be a valid callback, class 'Error' does not have a method 'index' Filename: core/CodeIgniter.php Line Number: 532 Backtrace: File: /var/www/monitors/index.php Line: 315 Function: require_once In my local system working fine but i move to the server i got this error 回答1: I got a similar error that I solved by renaming the Error class to Errors in application/controllers/Errors.php . In config

Message: call_user_func_array() expects parameter 1 to be a valid callback

最后都变了- 提交于 2020-04-11 04:36:07
问题 A PHP Error was encountered Severity: Warning Message: call_user_func_array() expects parameter 1 to be a valid callback, class 'Error' does not have a method 'index' Filename: core/CodeIgniter.php Line Number: 532 Backtrace: File: /var/www/monitors/index.php Line: 315 Function: require_once In my local system working fine but i move to the server i got this error 回答1: I got a similar error that I solved by renaming the Error class to Errors in application/controllers/Errors.php . In config

How can I pass input value from view to controller and model to fetch data correctly? Codeigniter

你离开我真会死。 提交于 2020-03-25 18:22:47
问题 I am trying to fetch a data that has the same id of my input hidden value. I cannot fetch the id or input hidden value of the data To start with, this is what I've done to make things clearer for me to debug things I made a hard coded form and a button to bring me to the page In View - groups/index.php As you can see I made the posts/index/1 which is a hard coded value but I can change that later easily that is not my problem <?php echo form_open('posts/index/1') ?> <input type="hidden" name=

How can I pass input value from view to controller and model to fetch data correctly? Codeigniter

放肆的年华 提交于 2020-03-25 18:22:13
问题 I am trying to fetch a data that has the same id of my input hidden value. I cannot fetch the id or input hidden value of the data To start with, this is what I've done to make things clearer for me to debug things I made a hard coded form and a button to bring me to the page In View - groups/index.php As you can see I made the posts/index/1 which is a hard coded value but I can change that later easily that is not my problem <?php echo form_open('posts/index/1') ?> <input type="hidden" name=

Where_in in codeigniter

别等时光非礼了梦想. 提交于 2020-03-03 04:26:56
问题 I'm using Codeigniter 3 to build a website. But now I have an issue with get data from database. this is my Model: public function Get($arr_condition = null) { if(!is_null($arr_condition)) { $this->db->where($arr_condition); } $query = $this->db->get('cus'); if($query->num_rows()>0) { return $query->result_array(); } return false; } In Controller, I use an array ($arr_condition) to get list conditional: $arr_condition['Cus_team'] = 1; $arr_condition['Cus_user != '] = 2; $arr_condition['Cus