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

  • Home
  • SEARCH
  • 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 9063859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:06:24+00:00 2026-06-16T16:06:24+00:00

i would like to export excel to specific folder where user can save it

  • 0

i would like to export excel to specific folder where user can save it wherever they want. currently i already succeed with export to excel but i test it locally and it downloaded to my local server folder. i hope someone can help me. thank you.

$id=$_GET['id'];
$excel=new ExcelWriter("./excel/company".$id.".xls");
if($excel==false)   
echo $excel->error;
$myArr=array("NO", "COMPANY", "ADDRESS1", "ADDRESS2", "ADDRESS3", "POSTCODE", "CITY", "STATE", "PHONE NO", "FAX NO", "EMAIL", "WEBSITE");
$excel->writeLine($myArr);
$qry=mysql_query(" SELECT organizations.*, states.state, cities.city FROM organizations, states, cities WHERE idOrg='$id' AND organizations.state_id=states.idState AND organizations.city_id=cities.idCity");
if($qry!=false)
{
    $i=1;
    while($res=mysql_fetch_array($qry))
    {
        $myArr=array($i,$res['companyName'], $res['add1'], $res['add2'], $res['add3'], $res['postcode'], $res['city'],$res['state'], $res['phoneNo'], $res['faxNo'], $res['email'], $res['website']);
        $excel->writeLine($myArr);
        $i++;
    }
}
  • 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-16T16:06:26+00:00Added an answer on June 16, 2026 at 4:06 pm

    Your question title suggests that you are under the assumption that, using PHP, you can save an Excel file on the client’s PC. Not exactly. You can save it to your local webserver (as you’ve already found out). But to transfer that to the client PC, you should offer it up as a download.

    Once the file is done being written (as you are already doing), present the user with a link to the file on your server. They will then be able to choose where it should be downloaded on their PC.

    Another possibility would be to write out the excel file data as the HTTP response and set the Content-Type header to something like application/vnd.ms-excel (or whatever is correct for your file type) and a Content-Disposition of attachment (example).

    I’m not familiar with ExcelWriter, so I don’t know if it has some kind of a dump function or not. Perhaps after you write out the file you just do something like this:

    header('Content-Type: application/vnd.ms-excel');
    header('Content-Disposition: attachment; filename=company'. $id .'.xls');
    
    echo file_get_contents('./excel/company'. $id .'.xls');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel table with some data that I would like to export
I'm using IIS6 using powershell I would like to export a specific virtual directory
I have a very simple, three-column excel file: I would like to export it
I would like to export predefined excel table ranges (those from Excel 2007 &
I would like to export an HTML table to a MS Excel document (and
I would like to add the hyperlink in export the dataTable into excel But
I would like to export the contents of a <rich:dataTable> or <rich:extendedDataTable> to excel.
I have a simple table which I would like to export to an Excel
I have a table that I would like to export to Excel but I
I would like to export a GridView to excel, which is easy enough. But

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.