The German Comet aircraft was fitted with upward firing rockets. these rockets would be set off by a photo electric cell when the shadow of the B17 went across it. It had recorded a few kills before they gave up using the Comet
i remember reading that the germans back then installed a similar mechanism on fighters like the 109ers to destroy allied bombers.
dont think it were THAT much guns installed, but it was similar.
the guns faced upwards and were activated through foto-cells.
See en.wikipedia.org/wiki/Schr%C3%A4ge_Musik for information on upward firing aircraft guns, called "Schrage Musik". It was also used for upward firing rockets, the GO 229 flying wing fighter was fitted with "Schrage Musik" - an upward firing array of rockets, triggered by an aircraft overflying a photo-electric cell in the upper side of the aircraft (Reference "Last Talons of the Eagle" by G Hyland and A Gill)