Something interesting happened today. I was working on a project for a client and the requirement was a file upload and downloadable system (with login of course ).. I had completed most of the stuff like login, uploading docs and the right click “save as” worked like a charm. BUT with the latest browsers like chrome and IE9\10, on clicking the link to the document, the files were getting opened either using Google Document Viewer or inside the browser itself – which was a no no for my client..
After trying to pick my brain for couple of hours I figured it could be a server thing and all I had to do was to make sure that I pass the correct header for the respective files (could be .zip, .doc or .pdf or . anything else).
Then it flashed!
I figured it out… The problem was a server problem. Since I was using the WordPress framework to build the site, the header was automatically passed for content and hence the files would open-up inside the browsers. I had to add a small code – just 4 lines in order to make this happen. Here’s what I wrote in order to force the data download:
Header set Content-Disposition attachment
And that was it! All those hours of brain picking finally paid off
I added the above code to the .htaccess file and the rest was taken care by my server Let me explain the above code:
FilesMatch: Simply tells the apache server for the document types. Here I only need to make .doc, .pdf, .zip etc as downloadable.
ForceType application/octet-stream: This told apache that the file types listed above is a generic content (MIME) type. So the browser should try to will always show the “open with” or “save as” download dialog if a server sends a file with such a MIME type.
Header set Content-Disposition attachment: Then I set the header of the webpage manually and woah! We’re done and that’s it!
For anyone having similar trouble.. Hope this helps!
According to foreign media reports, an independent research firm NSS Labs recently released reports showing that Microsoft’s IE 8 browser is the securest and the only browser with highest performance. The study also shows that the interception of social engineered malicious software, in 2010 Quarter1.
Malware interception chart:
IE8 intercepted 85% of the social engineering malicious software,
Firefox 3 interception rate of 29%,
Apple Safari interception rate of 29%,
Google Chrome 2 interception rate of 17%, while the
Microsoft IE project manager James Pratt and Senior director and project management Ryan Gavin have said that Microsoft has been focusing on the development of browser security features.
Gavin pointed out that Internet users are more concerned about identity theft issues and privacy protection issues. People’s private information-sharing approach will be different, but a person on the identity theft has always been opposed. Microsoft’s operating system and browser client security can be protected.
Pratt said that social engineered malicious software are huge and all around the web and its harmful consequences are growing. Internet users will be without the knowledge of accessing dangerous sites. Microsoft also promoted the SmartScreen filtering system through to get the network data. For example, a phishing attack on Hotmail accounts may be detected hundreds of millions of times.