php - move uploaded file success but could not find file in folder -
i have following code
public function upload() { if($_files){ $this->load->model('account/customer'); $file = $_files['profile']; $file_name = $file['name']; // $ext = end(explode('.', $file_name)); // $file_name = 'na_'.md5(time()).'.'.$ext; echo $file_content = $file['tmp_name']; $data = array('customer_id' => $this->customer->getid(), 'img_url' => $file['name']); $this->model_account_customer->profileimage($data); echo 'test/'.$file_name; $img = move_uploaded_file($file['tmp_name'], 'test/'.$file['name']); if($img) { $return = json_encode(array('status' => 1)); } else { $return = json_encode(array('status' => 0)); } echo $return; } }
the above code returning status
1
not see file in folder. check folder permission 0777
try appending /
in front of path
move_uploaded_file($file['tmp_name'], '/test/'.$file['name']);
Comments
Post a Comment