473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

text file displaying on screen

I have a file that downloaded a CSV file for the user based upon some
information gathered from the Database. My file was working fine until
recently (I believe that my hosting company did something when they
upgraded to PHP5). Everytime a user tries to download the file, it
displays the contents on the screen. Here is what I have for my file
handling. Am I missing anything obvious?

when called, $filecontent is displayed to the screen...

$downloadfile=$shownic."AttendeeRoster".time().".c sv";
header("Content-disposition: attachment; filename=$downloadfile");
header("Content-type: text/css; charset=UTF-8");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($filecontent));
header("Pragma: no-cache");
header("Expires: 0");
echo $filecontent;

Any help is greatly appreciated.

~Brad

Apr 26 '06 #1
4 1748
Update. The log shows:

[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 333
[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 334
[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 335
[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 336
[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 337
[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 338
The first header line is 333
The last header line is 338

Apr 26 '06 #2
Rik
Brad wrote:
[Wed Apr 26 14:03:25 2006] [error] PHP Warning: Cannot modify header
information - headers already sent by (output started at
/home/easyshow/public_html/includes/showdb.inc:52) in
/home/easyshow/public_html/adminusersstatsdownload.php on line 333


Somewhere in the code data is sent to the user (even a space or blankline is
data), presumably at
/home/easyshow/public_html/includes/showdb.inc:52. Fix this and headers
will work again.

Grtz,
--
Rik Wasmus
Apr 26 '06 #3
Rik,

Thanks, I have been seeing where there were extra links before the
<?php in the file, but I had extra lines after the ?> in the include
files.

Thanks for you help. I appreciate it.

~Brad

Apr 26 '06 #4
Brad said the following on 26/04/2006 20:10:
I have a file that downloaded a CSV file for the user based upon some
information gathered from the Database. My file was working fine until
recently (I believe that my hosting company did something when they
upgraded to PHP5). Everytime a user tries to download the file, it
displays the contents on the screen. Here is what I have for my file
handling. Am I missing anything obvious?

when called, $filecontent is displayed to the screen...

$downloadfile=$shownic."AttendeeRoster".time().".c sv";
header("Content-disposition: attachment; filename=$downloadfile");
header("Content-type: text/css; charset=UTF-8");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($filecontent));
header("Pragma: no-cache");
header("Expires: 0");
echo $filecontent;


Are you sure you don't want "text/csv", rather than "text/css"??
--
Oli
Apr 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul M | last post by:
Hi there, i hope someone can help me out here.. I have a input screen where i want the user to enter text in 2 different languages, english and macedonian. How is it possible to make the...
1
by: norwich | last post by:
Hi, I'm trying to display customer details on screen from a file using functions. The details are written to the file first then I display them on screen after I search for the file. My...
14
by: SD | last post by:
I am thinking about writing a text editor in C for unix sometime soon. I am just doing this to learn more about C. I want to write something like ed.c, a simple line editor. What types of data...
2
by: jonny | last post by:
Everyone, I am having a problem with perfromance and the drawing of strings on a panel control and I am hoping you all can help or at least provide me with some good reference material. Here is...
0
by: Earl Teigrob | last post by:
I can create a new custom control (and not change it) and add it to the toolbox and drag it onto the disign screen and it works just fine, displaying the text . However, when I add the following...
5
by: Amjad Farran | last post by:
What is the easiest way to display in a table, a delimited text data saved in a text file? I need an idea so that I can research it! Amjad
4
by: Ty | last post by:
I have a problem that should be relatively easy to fix but the solution just seems to elude me. I am creating a Windows app that contains a text box that I wish to fill with data from a file. ...
3
by: Leonardo da Vinci | last post by:
Greetings gentlemen and ladies, I have a question: in Tkinter, how to align a Listbox entry (i.e. a line of text) to the right? Google did not show up the answer to my request. Thanks very much....
3
by: =?Utf-8?B?SlIx?= | last post by:
I would like to add text to an image. I have tried to use DrawString and it works on some images but on others it is very very small. I am pretty sure it has something to do with the size of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.