So heres how it can be done ...........
Open the document library where you want to restrict the upload and open in explorer view option.
Add a Content Editor Webpart to the page.
In the tool pane of the CEWP - Source Editor.- Add the below javacript codes.
Delete the explorer view of document library.