Quote:
Now on click of any file it should be open in browser(Not to download)
It is impossible.
Anything that is displayed on client screen must be downloaded first, no matter what.
And once downloaded, you can't prevent the user from saving the file.
Quote:
with my code i am already able to open pdf and png files in browser, I am not able to open Word files with that.
Your code don't do any magic, any browser know how to display a png and a pdf with help of a plugin. And no browser know how to display a word file, because there is no plugin for it.
In order to display any file format not supported by browser, you have 2 vhoices:
- on browser side, write a plugin to display that file format.
- on server side, write a translator that will transform the file to a browser known format like html.