473,661 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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."Attend eeRoster".time( ).".csv";
header("Content-disposition: attachment; filename=$downl oadfile");
header("Content-type: text/css; charset=UTF-8");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($filec ontent));
header("Pragma: no-cache");
header("Expires : 0");
echo $filecontent;

Any help is greatly appreciated.

~Brad

Apr 26 '06 #1
4 1760
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/adminusersstats download.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/adminusersstats download.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/adminusersstats download.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/adminusersstats download.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/adminusersstats download.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/adminusersstats download.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/adminusersstats download.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."Attend eeRoster".time( ).".csv";
header("Content-disposition: attachment; filename=$downl oadfile");
header("Content-type: text/css; charset=UTF-8");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($filec ontent));
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
2785
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 macedonian input boxes so when you type into them, it is entered into macedonian font? I dont want the users to be downloading anything also. thanks,
1
1334
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 problem is this:
14
8782
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 structures would be appropriate? I am thinking about using a linked list, but I am also wondering whether a tree would be useful. Please give me your ideas...thanks, tilak
2
1786
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 what I am doing: I am using C# 2003 and reading into a file in real-time and as I scroll a scrollbar control, I am grabbing the bytes, converting them to chars, calculating the number of visible lines and creating an array of strings (not in...
0
1215
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 datepicker control to the toolbox, it just shows a yellow dot and thats it. What happened to the text??? Earl
5
1417
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
1505
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. The file contains approximately 40k, 60 character entries and it is taking an enormous amount of time to load the file contents into the text box. Is there some way to speed this up? I am currently reading an entry from the file and using the...
3
12092
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. L
3
2510
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 image but I have had varying results on multiple images. Is there anyway to make the text a fixed size on the image. Similar to putting a date on a photograph.
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.