public function imgProfile() { $nick = $_SESSION['username']; $m = new Model(Config::$mvc_bd_nombre, Config::$mvc_bd_usuario, Config::$mvc_bd_clave, Config::$mvc_bd_hostname); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $result = $m->imgProfile($nick, $_FILES['fileImgProfile']); } $target_path = "web/images/users/"; $target_path = $target_path . basename($_FILES['fileImgProfile']['name']); //$ext = pathinfo($target_path, PATHINFO_EXTENSION); if (move_uploaded_file($_FILES["fileImgProfile"]["tmp_name"], 'web/images/users/' . $_FILES['fileImgProfile']['name'])) { rename("{$target_path}", "web/images/users/" . $nick . ".jpg"); } header("Refresh:0; url=./profile"); }