FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Send .csv file to browser
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Send .csv file to browser [message #170036 is a reply to message #170034] Wed, 06 October 2010 15:26 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Álvaro G. Vicario wrote:
> El 05/10/2010 16:19, Derek Turner escribió/wrote:
>> I want to use MySQL to get a list of email addresses and names and then
>> output a .csv file to the browser so that it can be saved and then
>> imported into Thunderbird etc.
>>
>> Having googled around I think the solution will be:
>>
>> 1. Create and open a local file for writing
>>
>> 2. Write the data to the local file and close it
>>
>> 3. Use appropriate header files and then readfile()
>>
>> 4. Delete the local file
>>
>> Questions:
>>
>> 1. Is this a reasonable approach? Or should I be outputting to the
>> browser on the fly? Or using PEAR or something like that?
>
> The main benefits of generating a temp file are:
>
> 1. You don't have to hold the complete file in memory

That's not mandatory anyway, if you are e.g. prepping a db for a dump

You can simply output headers, and then stream the data out..as you read
and prep itt..


> 2. You can reuse the output

If that's relevant, yes.

>
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: file access permission?
Next Topic: Process queue without cron jobs
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 11:29:19 GMT 2024

Total time taken to generate the page: 0.04532 seconds