functional analysis – Classic excecise of $L^p$ spaces but using uniform boundedness principle

I have the following exercise:
Let $f$ a real-valued Lebesgue measurable function on $(0,1 )$, if $fg$ is Lebesgue integrable on $(0,1)$ for any function $gin L^p((0,1),mathbb{R})$ with $p in (1,infty) $, then $fin L^{frac{p}{p-1}}((0,1),mathbb{R})$.

This is an exercise I remember from my Lebesgue Measure course, I think we proved the results for simple functions and then extend the result to $f$. But here I need to use the uniform boundedness principle, so I think I somehow need a sequence of operators, but I really don’t know how to do this.

Any hints appreciated!