php - Codeigniter: trying to update profile with codeigniter -


i'm new codeigniter, , i'm trying make form updates profile. has worked before doesn't anymore. changed in view , stopped working. changed doesn't work anymore. spend half day trying make work again failed.

maybe don't see guys can see. @ least hope so.

this view:

<?php echo form_open_multipart('gids/do_upload');?>     <img width="200px" src="<?php echo base_url()."uploads/".$profile[0]['image']; ?>" alt=""/>     <label for="">uploade new picture:</label><input type="file" name="userfile" size="20" value="128.jpg" >     <input style="display: none" id="image" name="image" type="text" value="<?php echo "profile_picture".$_session['id'].".jpg";  ?>"/>     <label for="naam">naam:</label><input id="naam" name="naam" type="text" value="<?php echo $profile[0]['naam'];  ?>"/>     <label for="voornaam">voornaam:</label><input id="voornaam" name="voornaam" type="text" value="<?php echo $profile[0]['voornaam'];  ?>"/>     <label for="email">gebruikersnaam:</label><input id="gebruikersnaam" name="gebruikersnaam" type="text" value="<?php echo $profile[0]['gebruikersnaam'];  ?>"/>     <label for="email">email:</label><input id="email" name="email" type="text" value="<?php echo $profile[0]['email'];  ?>"/>     <label for="opleiding">opleiding:</label><input id="opleiding" name="opleiding" type="text" value="<?php echo $profile[0]['opleiding'];  ?>"/>     <label for="school">school:</label><input id="school" name="school" type="text" value="<?php echo $profile[0]['school'];  ?>"/>      <label for="wachtwoord">wachtwoord:</label><input id="wachtwoord" name="wachtwoord" type="text" />     <label for="typeagain">type opnieuw:</label><input id="typeagain" type="text" />      <label for="over">over mezelf:</label><textarea name="over" id="over" cols="30" rows="10"><?php echo $profile[0]['over']?></textarea>     <input type='text' style="display: none" name='student_id' value="<?php echo $profile[0]['student_id']?>"/>      <button class="btn btn-default" id="changeprofile" type="submit">wijzigingen opslaan</button>  </form> 

as can see there image upload controller:

function do_upload() {     $this->load->model("gids_model",'',true);     $config['upload_path'] = './uploads/';     $config['allowed_types'] = 'gif|jpg|png';     $config['max_size'] = '1000';     $config['file_name'] = 'profile_picture'.$_session['id'].'.jpg';     $config['overwrite'] = 'true';      $this->load->library('upload', $config);      if ( ! $this->upload->do_upload())     {         $error_upload = array('error' => $this->upload->display_errors());         redirect('gids/datum', $error_upload);     }     else     {         $this->gids_model->update_profile($this->input->post('student_id'), $this->input->post('voornaam'), $this->input->post('naam'), $this->input->post('email'), $this->input->post('wachtwoord'), $this->input->post('opleiding'), $this->input->post('school'), $this->input->post('over'), $this->input->post('image'), $this->input->post('gebruikersnaam'));         //$e = $this->input->post('student_id');          $data_upload = array('upload_data' => $this->upload->data());         redirect('gids/datum', $data_upload);     } } 

and model:

public function update_profile($id, $voornaam, $naam, $email, $wachtwoord, $opleiding, $school, $over, $image, $gebruikersnaam){           $data = array(                 'student_id' => $id,                 'voornaam' => $voornaam,                 'naam' => $naam,                 'email' => $email,                 'wachtwoord' => $wachtwoord,                 'opleiding' => $opleiding,                 'school' => $school,                 'over' => $over,                 'image' => $image,                 'gebruikersnaam' => $gebruikersnaam           );          $this->db->where('student_id',  $id);          $this->db->update('tbl_student', $data); } 

could please me out. don't know form_open_multipart('gids/do_upload') for, got tutorial upload images codeigniter.

here tried

public function do_upload() {          $this->load->model("gids_model",'',true);          // load library or can autoloading         // feature of ci         $this->load->library('upload');          // make sure folder uploads created         // @ root directory of project         $config = array(             'upload_path' => './uploads',             'allowed_types' => 'jpg|jpeg|jpg|jpeg|png',             'max_size' => '1000',             'file_name' => 'profile_picture.jpg',             'overwrite' => true         );          // use initialize instead         $this->upload->initialize($config);           if ( ! $this->upload->do_upload('userfile'))         {             $error_upload = array('error' => $this->upload->display_errors());              // can check errors here  using var_dump();             // uncomment the line below             // var_dump($this->upload->display_errors());die();             redirect('gids/datum', $error_upload);         }         else         {             $this->gids_model->update_profile($this->input->post('student_id'), $this->input->post('voornaam'), $this->input->post('naam'), $this->input->post('email'), $this->input->post('wachtwoord'), $this->input->post('opleiding'), $this->input->post('school'), $this->input->post('over'), $this->input->post('image'), $this->input->post('gebruikersnaam'));             //$e = $this->input->post('student_id');              $data_upload = array('upload_data' => $this->upload->data());             redirect('gids/datum', $data_upload);         }      } 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -