NYCPHP Meetup

NYPHP.org

[nycphp-talk] Creating file for download on the fly?

ken wu ken_11223 at yahoo.com
Fri Jul 26 11:22:09 EDT 2002


HI, all. i think you guys really have a great ideas
but i am sorry i couldn't follow it.  I want to ask if
the $csvfilecontent variables mentioned before was
generated by Excel cvs file or by our code or anything
else?

Thx for your time


--- Wellington Fan <beef at interport.net> wrote:
> All,
> I would add:
> 
> header("Content-length: ".strlen($csvfilecontent));
> 
> >-----Original Message-----
> >From: Kayra Otaner [mailto:kayraotaner at yahoo.com]
> >Sent: Friday, July 26, 2002 10:38 AM
> >To: NYPHP Talk
> >Subject: Re: [nycphp-talk] Creating file for
> download on the fly?
> >
> >
> >Hi, I think this self explaining code helps :
> >
> >header("Content-disposition:
> filename=$filename.csv");
> >header("Content-type: application/octetstream");
> >header("Pragma: no-cache");
> >header("Expires: 0");
> >echo $csvfilecontent;
> >
> >
> >PS : You need to use this code before any other
> output since header() 
> >function requires to be sent
> >before anything else.
> >
> >
> >Best
> >
> >Kayra Otaner
> >
> >
> >--- "Freedman, Tom S." <tfreedma at ubspw.com> wrote:
> >> Hi all, I've been a lurker for a couple months as
> I've been learning PHP,
> >> and many of your suggestions have been really
> helpful.  I was hoping someone
> >> might have an idea on how to tackle an issue I
> haven't been able to find any
> >> info on.
> >> 
> >> I'm currently working on a new version of a
> departmental intranet website.
> >> I have a database, and offer the users a search
> page that lets them query it
> >> in a variety of ways.  The new results page is
> not laid out in a grid, as
> >> the old one was (we've added a lot of new fields,
> and the grid would be too
> >> packed).  Some users have requested the ability
> to download the data for
> >> import into Excel (they used to just copy and
> paste the table in).  I've
> >> figured out how to create a .csv file, and I
> could, theoretically, create
> >> one every time someone runs a query, save it in a
> temp directory, and
> >> include a link to it on the webpage.  We'd have
> to run a cleanup routine
> >> every night, though, to delete all these .csv's
> on the server.  It seems
> >> really clumsy to me.  What I'd like to do is put
> a link on the result page
> >> that, when clicked on, builds the .csv right then
> and offers it to the user
> >> for download.  Is this feasible, or should I just
> go with the temp directory
> >> full of reports?
> >> 
> >> Thanks in advance,
> >> Tom
> >> 
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Yahoo! Health - Feel better, live better
> >http://health.yahoo.com
> >
> >
> 


=====
Ken Wu

718-788-0661
168 35 Street Apt 2
Broooklyn, NY 11232-2320

http://www.kenfile.com

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com



More information about the talk mailing list