Develop this function to upload files to the server but I do not understand why it works in windows and not in linux 7 cent, so that it works in linux should something be configured? permissions or something? I already change permissions of the folders and also check the route apparently everything is fine, the size of the file also probe with several sizes and remove the size configuration but it does not work. Please I need to solve it since at work I use linux and at home windows
public function addProduct(){
$archivo = $this->filePath();
$result = $this->m->addProduct($archivo);
$msg['success'] = false;
$msg['type'] = 'add';
if($result){
$msg['success'] = true;
}
echo json_encode($msg);
}
public function filePath(){
$config['upload_path'] = realpath('../image/product/') ;
$config['allowed_types'] = "*";//"gif|jpg|jpeg|png|GIF|JPG|PNG|JPEG";
$config['overwrite'] = TRUE;
$config['max_size'] = "50000";
$config['max_width'] = "2000";
$config['max_height'] = "2000";
$this->load->library('upload', $config);
$res = '';
if ( ! $this->upload->do_upload('txtFoto') ) {
$error = array('error' => $this->upload->display_errors());
$res = 'hola no funciona';
}else {
$file_data = $this->upload->data();
$file_path = './image/product/'.$file_data['file_name'];
$res = $file_path;
}
return $res;
}