FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Wrong extension





kaysch
http://www.kaysch.frihost.org/test

Right-click on the link, select "save target as" and you should receive an Excel file.
This works well under Google Chrome and Firefox, but it does not work under Internet Explorer 11. Internet Explorer suggests an htm extension instead. As a workaround the user could save it as .xlsx, he then gets the file correctly. But that is not how I want my site to work.

What do I have to do to make this site work?

Thanks upfront for your help.

Edit: My website programming skills are rather limited and outdated. All I am familiar with is an HTML editor called Namo, version 8. I have no clue about Java, Java Script, Perl, Joomla or whatever. I use IE11 and Win7 Ultimate x64.
Peterssidan
Test if adding the correct MIME type for the .xlsx extension makes a difference. In DirectAdmin you can do this by going to Mime Types under Advanced Features.

MimeType: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Extension: .xlsx
badai
is that a real file or generated by server side?
kaysch
Peterssidan wrote:
Test if adding the correct MIME type for the .xlsx extension makes a difference.
MimeType: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Extension: .xlsx


Thanks Peterssidan. I am now using this code for the website, but still it does not work under Internet Explorer.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test.</title>
</head>
<h2>
Links
</h2>
<p>
<a href="Test.xlsx" type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" target="_blank">Excel File</a></p>
</html>

badai wrote:
is that a real file or generated by server side?


It's a real Excel file.
Peterssidan
Try setting the MIME type in DirectAdmin as I described above. I don't know if it will make it work but at least it's worth a try.
deanhills
When I checked your link in my IE (I'm still on IE 8 as I'm on Windows XP) it came up with a ZIP extension.

I then Googled solutions for working around the ZIP extension result and the ones at the discussion below look interesting to try out. It's dated 2007, but maybe some of the suggestions in it (like for adding lines to the .htaccess file) could work for the current problem as well:
http://www.webdeveloper.com/forum/showthread.php?162526-Is-your-docx-file-turning-into-a-zip-SOLUTION&p=1122395

I particularly like Post #26:
http://www.webdeveloper.com/forum/showthread.php?162526-Is-your-docx-file-turning-into-a-zip-SOLUTION&p=1122395#post1122395
kaysch
I should have said that my website programming skills are rather limited and outdated. All I am familiar with is an HTML editor called Namo, version 8. I use IE11 and Win7 Ultimate x64.

Peterssidan wrote:
Try setting the MIME type in DirectAdmin as I described above. I don't know if it will make it work but at least it's worth a try.

Sorry for not replying to that suggestion. I was hoping I'd just have to add the code you suggested into my HTML file. Do I have to buy DirectAdmin to solve this? If I saw correctly it's 29 USD a month.

deanhills wrote:
When I checked your link in my IE (I'm still on IE 8 as I'm on Windows XP) it came up with a ZIP extension.

Exactly. I got the same result when I downgraded to IE 9.

deanhills wrote:
I then Googled solutions for working around the ZIP extension result and the ones at the discussion below look interesting to try out. It's dated 2007, but maybe some of the suggestions in it (like for adding lines to the .htaccess file) could work for the current problem as well:
http://www.webdeveloper.com/forum/showthread.php?162526-Is-your-docx-file-turning-into-a-zip-SOLUTION&p=1122395

I particularly like Post #26:
http://www.webdeveloper.com/forum/showthread.php?162526-Is-your-docx-file-turning-into-a-zip-SOLUTION&p=1122395#post1122395

OK, thanks for the research. Following the suggestion in post #26 I created a directory called WEB-INF at the root of my webspace. It's at the same level as the directories .php, backups, domain, imap and public_html. Then I created a web.xml file there, containing all this code: http://wiki.metawerx.net/wiki/Web.xml plus the code suggested in #26. It had no effect at all.

I also changed the code in the .htaccess file as suggested in #2. Unfortunately it did not solve the problem. The .htaccess file is currently located in a directory called "cgi-bin" at the same level of my test directory where the HTML file is. I hope it's in the right place there.

Any other suggestions?
Peterssidan
kaysch wrote:
Peterssidan wrote:
Try setting the MIME type in DirectAdmin as I described above. I don't know if it will make it work but at least it's worth a try.

Sorry for not replying to that suggestion. I was hoping I'd just have to add the code you suggested into my HTML file. Do I have to buy DirectAdmin to solve this? If I saw correctly it's 29 USD a month.

No you don't have to buy DirectAdmin. If I'm not mistaken DirectAdmin is the control panel that is used on server 4 (the server you're on). You find a link on the Account page.

You can also use the .htaccess method described by deanhills. It doesn't really matter. The important thing is that the Content-Type HTTP header is sent with the value application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. You can use some header checking tool to verify that the header is sent correctly.

You can test if it works here: http://dataapa.net/test/
It's exactly the same test as yours only that this sends the additional HTTP header as I described above. I don't have IE on this computer so I leave the testing to you.
kaysch
Excellent, it works! Very Happy

What I didn't know was that I need to enter http://www.kaysch.frihost.org:2222 to open Direct Admin. A search on previous posts regards DirectAdmin revealed that link.

Thanks a bunch Peterssidan. And many thanks also to deanhills although I have not figured out how to manipulate the .htaccess file in the way you suggested. I wonder whether my .htaccess file is in the correct directory: /domains/kaysch.frihost.org/public_html/cgi-bin

Anyway, as users can now download the Excel file from my site the betting round on the World Cup 2014 can begin. Smile
deanhills
kaysch wrote:
Anyway, as users can now download the Excel file from my site the betting round on the World Cup 2014 can begin. Smile
Oh goodie. Am beginning to pick up some of the fever myself. Very Happy
Peterssidan
Glad it worked out. Smile
Related topics
Ok a little help for a semi-beginner
Optimization is spelled wrong
C++ TUTORIAL : INTRODUCTION TO C++
Dynamic PHP Images
Site Nav Suggestions...
Tutorial: PHP Installed Modules Dynamic Reference Tool
Tutorial: Image Rollovers w/ Javascript
Which Firefox Extentions?
Bluetooth
GmailFS (shell extension) problem
need help enabling GD php extension
Uplaoding images using php form :::: Help needed
question from newbie
Interesting mistake - change extension on image
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.