  In this paper, we consider the following diagonal quadratic forms
\begin{equation*} a_1x_1^2 + a_2x_2^2 + \cdots + a_{\ell}x_{\ell}^2,
\end{equation*} where $\ell\ge 5$ is an odd integer and $a_i\ge 1$ are
integers. By using the extended Shimura correspondence, we obtain explicit
formulas for the number of representations of $|D|n^2$ by the above type of
quadratic forms, where $D$ is either a square-free integer or a fundamental
discriminant such that $(-1)^{(\ell-1)/2}D > 0$. We demonstrate our method with
many examples, in particular, we obtain all the formulas (when $\ell =5$)
obtained in the work of Cooper-Lam-Ye (Acta. Arith. 2013) and all the
representation formulas for $n^2$ obtained by them in (Integers, 2013) when $n$
is even. The works of Cooper et. al make use of certain theta function
identities combined with a method of Hurwitz to derive these formulas. It is to
be noted that our method works in general with arbitrary coefficients $a_i$. As
a consequence to some of our formulas, we obtain certain identities among the
representation numbers and also some congruences involving Fourier coefficients
of certain newforms of weights $6, 8$ and the divisor functions.
