I've just finished a marathon of submarine films, and a very common scene is where the submarine gets absolutely smashed by depth charges while just sitting there unable to do anything. (No idea how realistic this is by the way)
Which got me thinking, why weren't there any torpedo bays that could shoot upwards? Or floating bombs that went straight up? Like a reverse depth charges that exploded as they got within a few feet of the surface.
They could have released a volley of them and blown the destroyers out of the water, with a bit of luck.
Any reason this type of attack wasn't invented or wasn't possible?
Such a system using rockets was in fact considered and attempted during WWII, the Ursel system considered for the advanced Type XXI U-Boat. It was ahead of its time, however, and was never deployed. See http://www.hisutton.com/Type-XXI-U-Boat-of-World-War-Two.html for some details and more or less fanciful ideas on mounting locations.
Trying to do this with a conventional torpedo or mine would be a challenge. Just as timing depth charge attacks on a submerged target is difficult (and why the deployment of forward-firing weapons like the Hedgehog was such an increase in capability), timing an upwards-facing weapon to strike a destroyer closing at speed would be very difficult.
The real reason such a weapon was not explored in the long term is that weapons designers and navies envisioned a much more capable (and general-purpose) weapon, the acoustic homing torpedo. First deployed in 1943 (almost simultaneously) by both Axis (G7e/T4 and G7es/T5) and Allied (Mark 24 Fido "mine") forces, it provided a much more flexible means of attacking a target. While homing torpedoes then (and now) have some limit of minimum range for safety reasons, they make it possible to strike an active maneuvering target like an escort bearing down on you.