kotekzot
kotekzot

Reputation: 1588

Browser trying to save .xlsx file as .zip

A website running on Apache has the following innocuous line to link an .xlsx spreadsheet for download: <a href='/files/files.xlsx'>Download</a>

When I click it, Opera offers to download the file as a .zip instead. While .xlsx files are valid .zip files, I would prefer them to be downloaded as spreadsheets. How can I prevent this behavior?

Upvotes: 0

Views: 3057

Answers (1)

kotekzot
kotekzot

Reputation: 1588

Adding the following to .htaccess in the site's root directory solved the issue

# XLSX
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx

Here's a good sample .htaccess file configured with various popular extensions MIME-type pairs.

Upvotes: 1

Related Questions