Problem about Upload Filename into Database? |
[eluser]Unknown[/eluser]
Hi all, i am a new CI. i has a problem about Upload file and save filename into Database. Code: Control 1. I can not find filename for insert into SQL. 2. if i want another file. how i do?. Thank.
[eluser]Michael Wales[/eluser]
After a successful upload you may use the data() function to return information about the uploaded file. The one in particular you are after is: Code: $this->upload->data('file_name') This can all be found at the bottom of the documentation. I'm not sure what you mean on the second question.
[eluser]Zeeshan Rasool[/eluser]
check acording to this sample. $config['upload_path'] = './resources/admin_videos'; $config['allowed_types'] = 'mp3'; $config['max_size'] = '5000'; //$config['overwrite'] = false; $this->upload->initialize($config); $this->load->library('upload', $config); if(!$this->upload->do_upload($video)) { $error = array('error' => $this->upload->display_errors()); return $error; } else { $data = array('upload_data' => $this->upload->data()); $video_path =$data['upload_data']['file_name']; } $array = array( 'video_title' => $this->input->post('title'), 'video_path' => $video_path ); $this->db->set($array); $this->db->insert('help_video'); |
Welcome Guest, Not a member yet? Register Sign In |