Henry wrote:
> It didn'ti work ;-(
>
> Just showed a page with the data in!
>
> How would I do it with a file in any case?
>

You can give the PHP script the extension .csv and use AddType
application/x-httpd-php .csv to your httpd.conf or .htaccess file.

If you want to use a temporary file, you should use something like

$string = 'a, b, c, d, e, f';
$fp = fopen( 'tempfile.csv', 'w' );
fwrite( $fp, $string );
fclose( $fp );

After file creation you should redirect the user to the .csv file.
The problem here is that you cannot delete the temporary file afterwards.

My first option is the one I'm using myself. You can't put all your faith in
header("Content-disposition: filename=$fnsave");
because most browsers won't understand it (and ignore it). If you give your
php file the .csv extension, then no browser can ignore it. They think it's
a normal .csv file, which should be opened with (for instance) Excel...

HTH
Erwin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to