I am reading the file from the database and trying to open the file in browser. My code is below...
when I am doing like this at that time file is automatically downloaded
response.setContentType("application/octet-stream");
response.setHeader("Content-disposition", "inline; filename=\""+ docName + "\"");
But when I am doing like this at that time file is opening in browser.
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "inline; filename=\""+ docName + "\"");
It is happening due to mimetype "application/pdf". But in my application I don't know the file's mimetype. It can be anything like pdf, image, txt, doc etc. So, I want to keep my mimetype default that is "application/octet-stream" and I also want to open that file in browser.
Please help me out.
Thanks in advance...