Shanghai Street Directories 上海市行號路圖錄 for various years are offered for online viewing at the National Library of China 国家图书馆. Anyone can get an account online and start browsing immediately (if the subsequent logins don't work, Wechat login seems to help).
This 666-page Shanghai Street Directory (1940) covers the International Settlement, with the corresponding Business Map of the French Concession (1940) covering the rest of foreign Shanghai. The harsh black-and-white low-res scans do not convey the precision and color variation of the paper original, but they can be useful nonetheless.
National Library version:
The detailed maps from these atlases (atlai?) correspond to the 1939 Foreign Settlements Commercial Guide on the Virtual Shanghai GIS platform:
We also have a downloadable 1947 Street Directory, covering the French Concession and the Chinese City, hosted at the Internet Archive.