Can I be released on bail pending trial when I am detained in Shanghai?

It depends.

If it's only administrative detention, it's fifteen days at most. There is no bail for administrative detention (also called public security detention here).

If it is criminal detention, if there are no other circumstances, there may be the possibility of bail pending trial.

But it's not about money, it depends on the plot.