Yes, if you have a good reason to explain why you have to apply for a visa in Shanghai rather than Beijing.