Download Excel Message

See attached message.

I get this every time I download an Excel spreadsheet generated in php with the following header:

header("Content-type: application/");
$fn = "registrants" . date('Y-m-d_h_i') . ".xls";
header("Content-Disposition: attachment; filename=" . $fn);

If I change the file extension to xlsx will that solve this?

Richard KortsBusiness Owner / Chief DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Maybe try changing to .csv instead.  CSV files are almost universally associated with Excel.  You might also try adding a header that tells the length of the file.  And, of course, check to be sure that the file really is a spreadsheet.

If you want to post the PHP script and the data it uses to create the Excel file we might be able to reproduce the issue and offer some more suggestions.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard KortsBusiness Owner / Chief DeveloperAuthor Commented:

the spreadsheet is fine; it downloads & opens fine in Excel 16.

it's just the confusing message.

the customer gets confused.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.