prove $f\in L^2([0,1])$

We may assume $f\geq 0$. We need to show that $$ \Lambda_f : g\in L^2 \mapsto \int f g \; dx $$ is a bounded linear functional on $L^2$. If this is the case then by Riesz there is $h\in L^2$ so that $\Lambda_f(g)=\int hg \; dx$ and one sees that $f=h$ a.s.

So assume that $\Lambda_f$ is not bounded and let $g_n\geq 0$ be a sequence with $\|g_n\|_{L^2}=1$ so that $\Lambda_f(g_n) \rightarrow \infty$. Extracting a subsequence we may assume that $\Lambda_f(g_n) \geq 4^n$. Then $$ g= \sum_{n\geq 0} \frac{1}{2^n} g_n$$ has $L^2$ norm not greater than $2$ but by monotone convergence $\Lambda_f(g)=+\infty$.