Solved

Cannot download .xlsx file from Apache webserver

Posted on 2009-05-19
5
726 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 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