Page 1 of 1

excel file displayed as webpage

PostPosted: 27. March 2018 21:15
by kpete32
I have a few PHP files that are used to create webpages that allow users to download excel spreadsheets. These PHP files were on a windows 2003 server running apache 2.0 and they work properly on this server. When I open a browser and navigate to the webpage I am able to click on the download button for the excel spread sheet and windows asks if I would like to download or save the file. I moved the same PHP files to a windows 2012 r2 server and I am now using xammp with apache 2.2.14 and the excel spreadsheet now opens in a webpage instead of asking to be downloaded. I am not sure how to force this file to ask to be downloaded.

Re: excel file displayed as webpage

PostPosted: 28. March 2018 06:01
by Nobbie
The mime type is responsible for the behaviour of your browser, google for "Apache excel mime type".

Re: excel file displayed as webpage

PostPosted: 28. March 2018 13:24
by kpete32
where do i adjust the mime type at? I have a folder in xammp under apache\conf called mime types but it does not look like what I found online.

Re: excel file displayed as webpage

PostPosted: 28. March 2018 16:35
by Nobbie
google for "xampp mime types"

Re: excel file displayed as webpage

PostPosted: 28. March 2018 19:26
by kpete32
I have googled xammp mime types and the mime type for excel files is already in the proper file but the excel file still opens as an html webpage

Re: excel file displayed as webpage

PostPosted: 29. March 2018 00:48
by Nobbie
Ofcourse you must change the file type, try any compressed type or unknown or so, the browser then does not know that it is excel and offers a simple download.

Re: excel file displayed as webpage

PostPosted: 25. April 2018 15:11
by kpete32
The file type is set to excel and it opens properly on a windows 2003 server running the same code it just does not work on a 2012 R2 server