Upper critical field for superconductors with edges and corners