php - Codeigniter Upload Files/image only works when offline -
i made code upload files on web, when still using xampp, going well, after upload hosting, file uploading not working..
here's code :
model (for updating database record)
function edit_logo_web() { $timestamp = date('ymdhi'); $img = $_files['userfile']['name']; $logo = $timestamp."_".$img; $data = array ( 'logo' => $logo ); $id = 1; $this->db->where('site.id', $id); if($this->upload->do_upload()){ $this->db->update('site', $data);} else{ } }
controller (for uploading img/file web directory)
function logo_web() { $timestamp = date('ymdhi'); $img = $_files['userfile']['name']; $config['file_name'] = $timestamp."_".$img; $config['upload_path'] ='asset/img/'; $config['allowed_types'] = 'gif|jpg|png|bmp|jpeg|png'; $config['max_size'] = '1024'; $config['max_width'] = '1600'; $config['max_height'] = '1200'; $config['remove_spaces'] = false; $this->load->library('upload', $config); $data = array('upload_data' => $this->upload->data()); $this->m_cmm_bimbel->edit_logo_web(); echo "<script> alert('success !!'); window.location.href='logo_web'; </script>"; }
it in xampp localserver.. not in hostingserver..
any tips?
Comments
Post a Comment