Solved

Cannot download .xlsx file from Apache webserver

Posted on 2009-05-19
5
720 Views
Last Modified: 2012-05-07
I am trying to add a hyperlink to a PHP page running on our local webserver running Apache 2.2.11. I am linking an Excel 2007 spreadsheet (.xlsx) II have no administrative rights to this server, just the webroot.

When I link to this file, it tries to load a bunch of garbage into my browser window. If I right click the link and Save As, this works just fine, however I would like a download prompt when users click on this link.

I have added an .htaccess file in the directory of the PHP page and xlsx file. with just the line below, thinking this might clear the issue up, but it has not. I should also note that .xls (Excel 2003 and previous) files will behave correctly when clicked. What am I missing here?
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx

Open in new window

0
Comment
Question by:Tabris42
  • 3
  • 2
5 Comments
 

Author Comment

by:Tabris42
ID: 24425587
To add more to this mystery, I only get the junk in Firefox, here's a sample of the first bunch of it:

PKýýýýý!ýuBýRýýýýýýýý[Content_Types].xml ýý(ýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýýUýNý0ý#ýýýýq      !ý# ý|ýýýýý6ýýýý=ýVPýH%H\ýpý3ýýýýývSWýg3qýýE6wýý"ýýýuHýýjr2ýýýÓý|ýýýýýýýýHýy      ýýýyýýeýBýý_C!ý—ýýy1_ýýYK#ýb:ýýýZUý<lxýUýfýHýýý"U&ýýýýPýýýdý ýývýfý}ýýýýýJ}0ýf@      ýýýýýýýýýý:G<ýMýhH^Tý'Uý&ýý$qýý^ýSýýýý8ý
ýYDýi[ýýýP ýcý(Hý

However when I download with IE, it downloads it, but wants to treat it as a .Zip file! I do have Office 2007 on my machine.
0
 
LVL 1

Expert Comment

by:halonx
ID: 24425704
Does your web host have "AllowOverride" turned on?

If so, do they have a custom file name to use instead of .htaccess?
0
 

Author Comment

by:Tabris42
ID: 24425893
Couldn't tell you... the guy who runs this server just went on leave for 4 months and noone else knows anything about the server, unfortunately. Is that the only way I can make this work?
0
 
LVL 1

Accepted Solution

by:
halonx earned 500 total points
ID: 24425938
AllowOverride definitely needs to be turned on for you to use a .htaccess file.  

If you had access to the Apache server config you could either turn AllowOverride on or just add the file type to the base Apache config.
0
 

Author Comment

by:Tabris42
ID: 24466522
Thankfully the guy acting for the other guy who went on leave for four months knows his stuff and knew exactly what I was asking for. He did not enable AllowOverride, but instead made the Office 2007 file formats downloadable from the webserver. Thanks for your answer!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question