473,397 Members | 2,068 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,397 software developers and data experts.

file download three blank lines at start

Hi
I got this info from
http://forums.dreamincode.net/showtopic10131.htm
and it works ok with saving the file on the server
but when I use the
'2 - To create the file for the user to download'
the file always starts with three blank lines and
then the data, when opened with spreadsheet, text
editor, or pager.

I have tried both ways and the only real change is
the addition of the 'header(...)' lines. Any ideas
how to stop the header(...) lines from spitting
out newlines?

The second header line is one line.

<?php
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment;
filename="filename.csv"');
header('Pragma: no-cache');
header('Expires: 0');

snip..

echo $data;
?>

Jul 17 '05 #1
2 2554
Tony Lissner wrote:
http://forums.dreamincode.net/showtopic10131.htm


Ditch that and start reading c.l.php instead.

--
Jock
Jul 17 '05 #2
Tony Lissner wrote:
Hi
I got this info from
http://forums.dreamincode.net/showtopic10131.htm
and it works ok with saving the file on the server
but when I use the
'2 - To create the file for the user to download'
the file always starts with three blank lines and
then the data, when opened with spreadsheet, text editor, or pager.

I have tried both ways and the only real change is
the addition of the 'header(...)' lines. Any ideas
how to stop the header(...) lines from spitting
out newlines?

The second header line is one line.

<?php
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename="filename.csv"');
header('Pragma: no-cache');
header('Expires: 0');

snip..

echo $data;
?>


Turns out it was some blank lines before
the first <?php in a few of the included
files.

It works fine now.
Jul 17 '05 #3

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

Similar topics

5
by: osmethod | last post by:
Hello, I'd appreciate any help which is offered to my problem. I'm using Acess 97. I have a flat text file which lists names and addresses. Sometimes, these can be 4 lines and sometimes 5...
6
by: Melissa | last post by:
Does anyone have a generic procedure for adding blank lines to reports like Sales details, PO details and/or Orders details. The procedure would need to count the number of line items, determine...
4
by: Stuk | last post by:
Hi, im false beginner in C so that`s why im writting here :). I have to write a Text Reformater, which should read data from text file every Verse. In text file may appear special directives (for...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
5
by: JackM | last post by:
I need a little guidance putting a script together. I'm trying to read a list of image links from a text file (not a database) and display them in a table on my page. I want to display them in rows...
13
by: bmurphy | last post by:
Last week after much searching, I found the answer to my problem in this newsgroup. I can't find the thread from which I got my solution, but I wanted to report back what worked. When the site...
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
2
by: rka77 | last post by:
Hi, I am trying to make a Python2.6 script on a Win32 that will read all the text files stored in a directory and print only the lines containing actual data. A sample file - Set : 1 Date:...
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?
0
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,...
0
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...
0
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,...
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.