Dimensional crossover in the upper critical field of layered superconductors.