473,651 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stop HTML output writing to file stream

code green
1,726 Recognized Expert Top Contributor
I am using the following to force a file dialog box to open
Expand|Select|Wrap|Line Numbers
  1. header('Content-Disposition: attachment; filename="'.$filename.'"');
  2. header('Content-type: text/csv');
Then open a file stream with
Expand|Select|Wrap|Line Numbers
  1. return $this->handle = fopen('php://output','w');
Which directs a file strean to output rather than write to a file.
Well that is how I understand it.
I then write the data then close the stream with
Expand|Select|Wrap|Line Numbers
  1. fclose($this->handle);
Problem is html output which I expect to display in the browser continues to write to the stream,
so HTML appears at the bottom of the CSV when opened.

What am I missing to close the file stream and output HTML?
May 10 '11 #1
0 1194

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6427
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html tags in this text file to well formed XHTML tags). The contents of the file contain html tags and the data in those tags. eg., <table cellSpacing=0 cellPadding=0 width="100%" align=center border=0> <TBODY> <tr> <td width="48%"></td> <td...
1
2399
by: sc | last post by:
I am generating some nested DataLists, but instead of displaying them on the client browser, I want to save the output HTML stream to an on-disk file in %temp%. What is the best way to do that? Thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
2216
by: frustrated | last post by:
I am trying to share a file stream between two threads, but havent got a clue as to how to do it. The first thread will be reading the file, and the second thread will(/might) be writing to the same file stream. I was going to pass a ref to the file stream to the second thread, but the problem comes when I am trying to read from one section of the stream and write to another. I dont want one thread changing the position of the stream...
6
11157
by: Divick | last post by:
Is there a way in C++ to have a file stream which is directly mapped to memory(virtual memory) without actually having to create a file and then memory mapping that file using system dependent calls? I need this because I don't want to create a regular file on disk (reasons for which are many , say directory permissions ), but being a file pointer, someone can use that pointer as a regular file descriptor for reading and writing. ...
7
9982
by: Lee | last post by:
Hi, I'm a stream virgin and am attempting to output strings to a file. My approach is to write the string initially to a 'stringstream' and only when complete write the stringstream to the file (ofstream). The process works fine however appears to be rather slow. For example outputting about 2Mb of data takes a couple of minutes (most of the time appears to be writing to the stringstream) and as I'm creating several hundred files in...
5
1989
by: Generic Usenet Account | last post by:
I have been able to recreate a problem that I am having with the file stream using the simple sample code given below. I am trying to read the number of lines in a file, relying on the getline method to read all the characters (including leading whitespaces) until the new line character (the default line delimiter) or end-of-file is reached. Then I close the stream, reopen it and repeat the procedure. I get the correct answer only the...
1
1262
by: rahulrsh | last post by:
I am doing an image processing project which requires multiple threads to operate and write to an output file stream... Is is possible by some function to read and write specific locations of a file stream or is everything serial ?
5
6862
by: Nitin Mahajan | last post by:
Guys Is there a way in C# to create a word object directly from a memory stream without passing that to hard disk (file stream). I think it doesn't makes sense to create a file just to read it again in to word object. If some one has some brilliant idea please share. In a nutshell this is what I'm currently doing ByteArray --File Stream --Word Object and this I want to do
5
1981
by: cnoe | last post by:
I need to program this. I'm not asking any code, but an idea from you would be helpful. Thanks. I open a binary file stream, which has millions or trillions of 1's & 0's some thing like this 1100100011101110111.......... for easy understanding lets take this
1
2506
by: perhapscwk | last post by:
$pdf->Cell(10,7,'test test test test test',1,0,'L'); Let say if i draw a table like above, since the string are longer than the width as i set (10), then some words will display out of the table. it seem fpdf quite difficult to use, any simple pdf class which able to use simple code like html to output pdf file? use html to draw a table seems much more easier than fpdf.
0
8349
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
8695
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
8460
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,...
0
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
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
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
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
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.