LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 12-02-2006, 02:12 PM   #1
matthewhardwick
Member
 
Registered: Oct 2003
Location: CA
Posts: 165

Rep: Reputation: 30
How do I link to odt/docx files in a webpage?


Hey I am trying to link to an odt (Open Document Text) file Internet Explorer always seem to want to open them in a zip program. I understand that a odt (and docx I have this problem with also) are infact ZIP files - but I want to be able to link to them in the same way I can a PDF or DOC for users to choose what doument format they want do download (PDF,DOC,DOCX,ODT).

If anyone knows of any kind of extra I can put in the tag, or some php or something I can use to make these download like normal files, and not ZIP files.

I think it is rather amusing that Firefox (and Opera) understands a DOCX is a Word file and asks to open it in Word, and yet IE programed by the same company wants to open it in WinZip!

TIA

Matt.
 
Old 12-02-2006, 02:45 PM   #2
b0uncer
Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Well, IE isn't something behind the word "best out there".

Good though that you care about it, I know many web site creators who would just have let the problem be as it is, "it's their fault if they use such a bad browser".

I thought there was a way to "force" downloading a file rather than opening it directly but as you are wrestling with that problem, I guess not..sorry for not being able to help atm.
 
Old 12-02-2006, 02:45 PM   #3
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
The server may be sending a MIME type that makes IE think it is a ZIP file. Try having PHP send the MIME type of application/vnd.oasis.opendocument.text or application/msword

As a hack to get around the problem, I have seen sites that say "right click and save as"... but that is not the ideal solution.

I don't use Windows, so I can not test by theory.

Last edited by chadl; 12-02-2006 at 02:46 PM.
 
Old 12-02-2006, 02:46 PM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Add an association for that mimetype. Even better would be to not use Internet Explorer. It's even the recommendation of the dept of Homeland Security.
 
Old 12-09-2006, 01:32 PM   #5
matthewhardwick
Member
 
Registered: Oct 2003
Location: CA
Posts: 165

Original Poster
Rep: Reputation: 30
I don't use windows.... I use Firefox for most of my stuff, IE or Opera for other things... but there are of course 70% or more people that use Windows and IE so I have to look after them especially concidering I am trying to get as many people as possible to read and print and sign this document. I don't look after the server or the PHP installation as I am hosting files on a Uni web server for someone else - but I will speak to the tech guys at the Uni to get it sorted out.

This is what I thought (that PHP reads the file and see's it is a ZIP file and sends that MIME - or something to that effect).

Thanks everyone.
Matt.
 
Old 12-09-2006, 07:41 PM   #6
chadl
Member
 
Registered: Sep 2005
Location: US
Distribution: Gentoo AMD64 Testing
Posts: 129

Rep: Reputation: 16
In PHP, you can change the headers in order to tell the browser the file type:
PHP Code:
header("Content-type: text/html"); 
However, doing this requires that you read the file in PHP, and echo it out to the browser, also setting the other headers such as Content-size.

Doing this does increase the server load slightly.

It is better if the Apache configuration is updated (actually the MIME magic file on the system) to a version that can identify open document files without all this code.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What program in Windows to convert ODT files? ToothlessRebel General 13 10-07-2009 12:54 AM
automatic conversion .doc to .odt? (several files) quarry_06 Linux - Software 2 01-31-2006 07:14 PM
ln -s link to webpage. Sapient Linux - Newbie 17 01-30-2006 03:43 PM
Wireless Network Link Established - No webpage though mrh7184 Linux - Wireless Networking 6 10-05-2005 12:49 AM
.docx, .xlsx, .pptx, XML Office formats? microsoft/linux General 1 08-02-2005 02:30 PM


All times are GMT -5. The time now is 03:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration