Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9107445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:34:24+00:00 2026-06-17T02:34:24+00:00

After building my spreadsheet using PHPExcel, I am unable to open the save as

  • 0

After building my spreadsheet using PHPExcel, I am unable to open the “save as” or “open” dialog. I got the following code snippet right from the examples directory that comes with the PHPExcel library.

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="01simple.xlsx"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;

My JavaScript:

$(document).on('submit', '#myForm', function(e) {
        $.post('mail.php', $(this).serialize(), function (data) {
            $('.signature-field,.notes').hide();
            //SUCCESS
            $('.successORfail').html(data);
                setTimeout(function(){
                    $(".successORfail").fadeOut("slow", function () {
                        $(".successORfail").empty().show();
                    });
                }, 4500);
        }).error(function() {
            alert("Fatal Error: mail.php not found!");
        });
        e.preventDefault();
    });

Note: the code above generates the alert message “Fatal Error: mail.php not found!” that I set up. Other than that, it does not generate any error messages, it does not save or create an excel file.

When I use the following method, without any headers, the excel file is created perfectly, and saves on the server, without any errors:

    $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
    $objWriter->save('MyExcel.xlsx');

I would truly appreciate any help with troubleshooting this error, as I have been working on this for a very long time now.

Many thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:34:25+00:00Added an answer on June 17, 2026 at 2:34 am

    You actually cannot do this the way you are attempting to do this. Javascript by itself cannot initiate a file download on the user’s system (due to security issues). I am aware of at least one jQuery plugin which gives an AJAX-like download experience. You might check this out:

    http://johnculviner.com/post/2012/03/22/Ajax-like-feature-rich-file-downloads-with-jQuery-File-Download.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'me getting the following after building from he command line using xcodebuild, ay ideas
I am using eclipse for C++ program. After building my code when I am
I got the SIGABRT signal after I changed the xib file. Right after building,
In have my application configured in asp.net. I am using ajaxcontroltoolkit. After building the
I get the following warning after building my app for distrobution. warning: building with
I have checked out some files from subversion repository. After building, there are a
After building an application by using ant, i am copied the component to a
I'm trying to statically link to libcrypto.a (from the openssl library) after building it
after building Qt using Visual Studio command prompt , my configure string: configure.exe -release
I am using Maven 3 for build Dashboard project After building my web application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.