Hmmm. From here I would be apt to check the permissions on the uploads folder to confirm they are 777 (I’m sure you already have). In addition to which I would throw error reporting into the plugin at about line 35 to see if there is any further information we can get.
error_reporting(E_ALL);
ini_set('display_errors', '1');
I changed
header('Content-Disposition: inline; filename="'.$the_filename.'"');
to
header('Content-Disposition: attachment; filename="'.$the_filename.'"');
and things seem to be working OK. Safari appends “.html” to the resulting filename, but Firefox behaves fine. Removing the “.html” results in a perfectly usable .csv file.
@Daniel. Thanks for your reply about my problem which to restate it is that I can’t seem to get the proper seperator. I have tried over and over in various ways including your suggestion of just using seperator=”“. Nothing works. Here is my latest:
{exp:csvee seperator="," query="SELECT email FROM exp_members WHERE email !='needs@email.com' AND email !='deceased@something.org'" show_headings="no"}
It seems simple but nothing seems to work. I was able to get the delimiter I want, which is a space only by editing the plugin itself. Even trying that for the seperator doesn’t help. Any suggestions? Thanks, Carole
@Daniel
{exp:csvee filename="survey.csv" seperator="," query="SELECT name, email, q1, q2a, q2b, q2c, q2d, q3a, q3b, q3c, q3d, q4a, q4b,q4c,q4d,q5 FROM exp_freeform_entries ORDER BY entry_date DESC " }
I am getting the results as text in the browser window, but I am trying to get a CSV file as a download. Is there something missing from my code?
@gavincooper: I was having the same issue. Note the change I had to make in the plugin in this earlier post.
Excellent Ryan! worked like a charm. The file has a .html that needs to be removed, but then works great. Although, my CSV file is putting all of the results in one row. The column heads are first and then the results are to the right instead of underneath. Anyway, I can wrap the results underneath the columns heads?
Hi there! Does anyone know if it’s possible to get the CSV file to download when loading the template. Maybe i’m doing something wrong, but when I load the template i just get the query results displayed at the browser, but not CSV file to download. Is it suppose to be like that?
This is the code that i’m using:
{exp:csvee delimiter=","
filename="test.csv"
query="SELECT
exp_weblog_titles.title as name
FROM exp_weblog_data
INNER JOIN exp_weblog_titles ON exp_weblog_data.entry_id = exp_weblog_titles.entry_id
WHERE exp_weblog_data.weblog_id='16'
ORDER BY exp_weblog_titles.title ASC"}
Thanks!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.