Solved

Cannot download .xlsx file from Apache webserver

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now