Problem Creating an Saving CSV-file -- on a client
Posted: Thu Mar 10, 2011 4:57 pm
Hi,
Good evening.
I have been coding a page which generates an csv file. Al works fine on my pc, but when i upload the page, i get these errors:
failed to open stream: No such file or directory in <b>/usr/www/users/...
failed to open stream: Permission denied in <b>/usr/www/users/...
Now, as i have read on the www it has something to do with persmission and the persmissions should be changed on the hosting server.
Now, is the any other way to generate and save the csv-file on client side? so that i dont need to create it on the server first?
I'm reather new to php so some good advice would be welcome.
This is part of the code i use to generate the csv file: ...
Anyone? 
Good evening.
I have been coding a page which generates an csv file. Al works fine on my pc, but when i upload the page, i get these errors:
failed to open stream: No such file or directory in <b>/usr/www/users/...
failed to open stream: Permission denied in <b>/usr/www/users/...
Now, as i have read on the www it has something to do with persmission and the persmissions should be changed on the hosting server.
Now, is the any other way to generate and save the csv-file on client side? so that i dont need to create it on the server first?
I'm reather new to php so some good advice would be welcome.
This is part of the code i use to generate the csv file: ...
Code: Select all
<?php
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename="gmail.csv"');
readfile('gmail.csv');
//----------------------------------------------------------------------------------------------------- define mailing list
//----------------------------------------------------------- connect to database
@mysql_connect($server,$username,$password);
@mysql_select_db($database) or die( "please login first");
@$query = "SELECT * FROM personen WHERE status='1'";
$result = mysql_query($query);
mysql_close();
//------------------------------------------------------------------ query array
$list = array();
$list[0] = array(.....);
$i = 1;
while ($personen_array = mysql_fetch_array($result)){
$list[$i] = array (..........);
$i++;
}
$fp = fopen('gmail.csv', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>