Selenium cannot handle any OS based dialogues like file browser. So if the upload element is visible on the page, then instead of using
switchTo() function you should directly use
sendKeys() function to upload a document as shown below:
So the control will always be on the original browser.
For more information just go through following link: Upload a file in Selenium Webdriver using sendKeys
If you want to learn to switch between multiple windows using selenium, then below mentioned link might help: http://stackoverflow.com/questions/34741257/how-to-change-between-pages-with-seleniumhttps://stackoverflow.com/questions/34741257/how-to-change-between-pages-with-selenium
Hope this helps :)