On 5/2/07, clive <clive@xxxxxxxxxx> wrote:
Todd Cary wrote: > Some shared servers do not allow the creation of a file, so I am looking > for a way to take the results of a query (MySQL), create a CSV output > and have it in a sendable format for the user without creating a file. > are you sure, then how could you say ftp the files to the server, are you not trying to create files in the wrong directory?
I have that too on one of my shared hosts, I can't create any files in my home directory, because the PHP user doesn't have access rights there, chmodding all directories did fix, (done through SSH). Before i figured out that I could chmod all directories, I found out that it does allow me to write in /tmp, and so i stored my files there, but only temporary of course, because /tmp is cleaned regularly
hmm if you want to allow the user to download the file, then just send the correct headers, using the header() function, for the csv format and then echo the contents of the file.
Yep, that's the correct way.
remember your application may spit out some other bits of text and this will interfere with sending the headers so you may also need to look at the output control functions to clean the outout buffer and then send your headers and data: http://www.php.net/manual/en/ref.outcontrol.php Regards, Clive.
I don't think that you will need output buffering, most functions allow you (or only) return values. Tijnema
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php