Support

Home Forums Event Espresso Premium Export CSV file button is not working

Export CSV file button is not working

Posted: September 18, 2024 at 7:43 am

Viewing 14 reply threads


FaithT

September 18, 2024 at 7:43 am

If I try and export registrations I get taken to a url (******.csv) showing all the registrations but no download option is visible. How do I get an actual CSV file or how do I use a website url with .csv at the end to open in Numbers on my Mac?
Thanks


Tony

  • Support Staff

September 18, 2024 at 7:49 am

Hi there,

This is usually due to an incorrect MIME type set up on the server, in short, the server is sending the CSV HTML/TEXT so the browser simply displays it.

If you open a ticket with your host and ask them to add this mime type to the server:

application/ms-excel .csv

Or this may also work:

text/csv csv;

Does the file then download?


FaithT

September 18, 2024 at 8:06 am

This reply has been marked as private.


Tony

  • Support Staff

September 18, 2024 at 9:54 am

Hi Faith,

Bot Response:
To add a MIME type in WordPress, you can use a plugin like “WP Add Mime Types” to extend the default MIME types. Alternatively, you can add custom code to your theme’s functions.php file using the upload_mimes filter to allow additional file types.

That’s for something different.

That’s to allow you to upload different filetypes within WordPress and that’s not what the issue is here.

I’ve been using EE for years and only just had this problem so can’t understand why I would need to add a plugin or go into the functions php file (which I’m always terrified to do)?

You don’t, thats not what is needed here.

To explain a little, the way in which EE sends the file to the browser hasn’t changed in years and is pretty much standard across all files. What changes is how your server handles MIME types and that then breaks downloads.

When you click to download a file the server sends back the contents of that file in a specific format, the MIME type is a way to tell the browser what the file is and what it should do with it. So when this happens it’s usually becuase the server is saying “here’s a file and the MIME is text/HTML”… your browser says “Oh… this .csv is text/HTML? That’s for me to display!” and so it displays it on the page rather than downloading it (I’m overly simplifying this somewhat but the idea is the same).

We (EventEspresso) already set a mime type within the directory but the server can (and often does) override that. So it may have worked previously and then you server changed PHP versions and now uses different MIME types than what it did previously… which now break the output. This is a common issue and your host should be able to fix this for you with a code change server side.

Could there be something bigger than this mime type issue going onto cause these two issues?

The CSV issue, is minor. It’s just mixing up the MIME type to tell what the browser should do with the file, it won’t be causing any other issues.

Having missing registrations between MailChimp and EE can be caused by so many different things it’s hard to say.

Some of those email addresses may have previously unsubscribed (MailChimp doesn’t resubscribe an emailn when you issue a subscribe call on an archived/unsubscribed email address, that is by design on their end).

There may have been an error on the request (generally you’d see an error on the page then or something within the logs).

But all in all, the 2 issues you’ve mentioned so far don’t point to a major issue here.


FaithT

September 19, 2024 at 10:34 am

This reply has been marked as private.


Tony

  • Support Staff

September 20, 2024 at 4:48 am

Hi Faith,

Just wanted to check in and see how you got on with this?

If you have FTP access to the site I can add the MIME type for you if that helps? (We recommend contacting your host to have them do it as they’ll have more access and know how their servers are set up)


FaithT

September 23, 2024 at 3:55 am

Might be posting this twice but think it didn’t submit just now so trying again:

WP Engine eventually got back to me and said to add the following to the functions php file:

function add_custom_mime_types($mimes) {
// Add Excel and CSV MIME types
$mimes[‘xls’] = ‘application/vnd.ms-excel’;
$mimes[‘xlsx’] = ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’;
$mimes[‘csv’] = ‘text/csv’;

return $mimes;
}
add_filter(‘upload_mimes’, ‘add_custom_mime_types’);

This doesn’t work though. I get a red error message if I try to download the CSV file.
Maybe this isn’t the right bit of code?

Many thanks


Tony

  • Support Staff

September 23, 2024 at 4:36 am

Yeah, thats going to fix this, your issue has nothing to do with upload_mimes.

Mind if I take a look? I’ll need WP admin FTP credentials if you have them and you can send them over using this form:

https://eventespresso.com/send-login-details/


FaithT

September 23, 2024 at 5:19 am

I filled in the form!
Thanks


Tony

  • Support Staff

September 23, 2024 at 5:37 am

This reply has been marked as private.


FaithT

September 23, 2024 at 5:42 am

This reply has been marked as private.


Tony

  • Support Staff

September 23, 2024 at 6:19 am

Hi Faith,

Ok, so this is indeed something that WPEngine needs to fix on their side.

The above reply they gave is based on changing what YOU can upload to your WordPress site and which MIME types are allowed for you to do that. It’s basically this article:

https://wpengine.com/support/mime-types-wordpress/

That’s NOT what the issue is here.

Event Espresso generates the report within a CSV file in /wp-content/uploads/espresso/batch_temp_folder/{random-directory}/

We generate the CSV file and a .htaccess file containing:

AddType application/ms-excel csv

To tell the server what MIME type to use for that file type, however, IIRC WPEngine uses Nginx and that will ignore the above file, meaning it relies solely on their server set up. They currently return text/plain; for CSV files which means your browser displays the file and it needs to be updated to at least use text/csv csv;.

This is NOT something you can fix with a snippet and they need to change it on the server for you. You can copy and paste the above (and even a link to this thread if preferred) within a ticket to WPEngine, if you get the same reply about using the upload_mimes filter then ask to be escalated to a higher lvl tech as I think they are misunderstanding the issue.

The problem is the response from their sever for CSV files and not related to uploading files at all.

See: https://monosnap.com/file/Rgu1vezJhaWlaIESAalpryT9wA601Y

I have a workaround for you for the time being but I still recommend you work through the above.

When you click to generate the CSV and it displays the content, right click (command + click) on the page and do Save As. The dialog should show up with the filename showing event-espresso-registrations-{date-time}.csv as the file.

Type should show as .CSV, something like this:
https://monosnap.com/file/Qkp3uslgKE7oiTBBg02o6QQ1c4vupK

Save the file and then open it, it should now open in whatever app you use to view them.

(Note – I’m a Windows user and have very little experience with Mac’s so forgive the ‘Windows-isms’)


FaithT

September 23, 2024 at 7:16 am

This reply has been marked as private.


FaithT

September 23, 2024 at 7:17 am

This reply has been marked as private.


Tony

  • Support Staff

September 23, 2024 at 7:37 am

This reply has been marked as private.
Viewing 14 reply threads

The support post ‘Export CSV file button is not working’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso