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 9209283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:48:21+00:00 2026-06-18T00:48:21+00:00

My PHP script is generating a CSV file. Upon clicking the download link, I

  • 0

My PHP script is generating a CSV file.

Upon clicking the download link, I want the browser to treat it as an attachment and show a download prompt.

This works correctly in Firefox but Internet Explorer 8 just shows the CSV file as text.

This is the PHP code generating the headers:

    return new Response( $vOutput, 201, array
        (
        'Content-Encoding' => 'UTF-8',
        'Content-Type' => 'application/octet-stream; charset=UTF-8',
        'Content-Transfer-Encoding' => 'binary',
        'Content-Disposition' => 'attachement; filename="entrance_stats_line' . $vLine . '.csv"',
        'Pragma' => '',
        'Cache-Control' => '',
        'Content-Length' => strlen( $vOutput ),
        'Expires' => '0'
        ) 
    );

(The framework used is Silex, relying on Symfony’s Symfony\Component\HttpFoundation\Response class, although I’m not sure that’s relevant )

The HTTP headers as received by Firefox (using Tamper Data) are:

Status=Created - 201
Date=Wed, 30 Jan 2013 15:53:38 GMT
Server=Apache/2.2.21 (Win32) PHP/5.3.10
X-Powered-By=PHP/5.3.10
Content-Encoding=UTF-8
content-transfer-encoding=binary
Content-Disposition=attachement;filename="entrance_stats_line1.csv";
Cache-Control=no-cache
Content-Length=6141
Connection=close
Content-Type=application/octet-stream; charset=UTF-8

I haven’t checked if the headers are modified in IE but I’ll post them if I manage to make Fiddler work.

I had tried a few other combinations of headers previously, including the following:

Status=Created - 201
Date=Wed, 30 Jan 2013 16:34:46 GMT
Server=Apache/2.2.21 (Win32) PHP/5.3.10
X-Powered-By=PHP/5.3.10
Content-Encoding=UTF-8
Content-Disposition=attachement; filename=entrance_stats_line1.csv
Cache-Control=no-cache
Connection=close
Content-Type=text/csv; charset=UTF-8

This just gives me a “Requested site could not be found” error.

The IE version is 8.0.6001.18702

  • 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-18T00:48:22+00:00Added an answer on June 18, 2026 at 12:48 am

    It’s “attachment”, not “attachement”.

    (also: there is no Content-Transfer-Encoding header field in HTTP)

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

Sidebar

Related Questions

I have a php script which is generating a log file. On the other
I am dynamically generating (in a PHP script) a .mobileconfig file for iOS devices
Possible Duplicate: PHP: Script for generating Crossword game? Does anyone know any PHP-based simple
I have a PHP script which is generating buttons to each content schedule. The
I'm generating auto incremental code through a PHP script. The sequence goes like this,
I have a script that generates a csv file using the following code: header('Content-type:
I am trying to write a server side script (PHP) for generating an SVG
I have a page where i am generating random pages using php script and
I have a script that is generating an image with PHP on a server,
I have a PHP script that is generating a MySQL select statement: select *

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.