views:

72

answers:

2

Hi All,

Solved

I actually found out what is going on here.

Turns out it was sending the whole file, but Excel (which I was using to open the result file for testing), will only display 65536 rows. If there are more than that, it will alert something to the effect of "the file is incompletely displayed" and then cut it off after that many records.

(Note to Joel Spolsky - please call your friends from the original Excel development team and yell at them for me =o)

Thanks!


I have a very simple script that pulls some data from a database, and sends it to the visitor as a .csv file.

I have the memory and execution time set to acceptable levels, but for a few large reports, I notice that the download cuts off after about 10 seconds.

This ONLY happens if I set it as a download in the headers. If I comment out the content-type, content-disposition, etc, and just write the data to the browser, then the entire file will download and display in the browser.

Code is as follows:

// Code removed.

Anyone have any ideas? Could this be a browser issue with file download?

Thanks!

+1  A: 

I don't know what's causing your problem, but here is something that you can try:

Write the data to a file and then send it to the user using the X-Sendfile(see this) header. Alternatively you can redirect to the file.

André Hoffmann
This is what I was going to do before I figured it out.
Eli
+1  A: 

I had a slightly similar issue, but with very slow downloads. The culprit was an overly aggressive antivirus package affecting only IE downloads. Check for Mcshield.exe.

Ross Morrissey