Solved

Cannot download .xlsx file from Apache webserver

Posted on 2009-05-19
5
732 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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