Theorem. The language accepted by a DFA M with n states is infinite if and only if M accepts a string of length k , where n≤k<2n.
This makes the decision problem simple: just try all strings of length at least n and less than 2n and answer "yes" if M accepts one of them and "no" if there's no string in that range that's accepted.
now question arises why there is need of upper bound
Without that upper bound, how would you know when to stop trying strings? This formulation makes the problem a decision problem (we can always answer "yes" or "no"), rather than a recognition problem (where we can only reliably answer "yes").