Skip Navigation

[Resolved] Import error – Cannot open zip

This thread is resolved. Here is a description of the problem and solution.

Problem: When importing CRED forms, I experience an error if I try to upload an XML file, even if it was generated by the CRED export process. The error says "Unable to open zip file"

Solution: Create a zip archive containing the XML file and upload the zip file instead of the XML.

Relevant Documentation: N/A

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#503800
CRED import issue.PNG

I am trying to: import CRED post & user forms

I visited this URL: hidden link

I expected to see: a green box with successful import details

Instead, I got: unable to open zip file

File being uploaded is not a zip, it's an xml and I've been able to import all other types settings in this same session (Access, views and types)

I've disabled all other plugins

#503937

Hi, I'll be glad to take a look and see why your file isn't being accepted.

1. Can you validate the output of the XML file to ensure a valid XML document was generated during the export process? A service like validator.w3.org would be fine.

2. Can you enable PHP debug logging and try to upload the file again? You can see how to enable debug logging here:
https://toolset.com/documentation/user-guides/debugging-toolset/

Go in your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

define('WP_DEBUG', true);

Then add these lines, just before it says 'stop editing here':

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');

Open up your browser's JavaScript console as well. Then attempt your import process once more. If any PHP errors are generated, this will create an error_log.txt file in your site's root directory. Any JavaScript errors will appear in your console. Please send me any errors you see. Once that is done, you can revert the updates you made to wp-config.php.

3. I see you have file.xml, file (1).xml, and file (2).xml for all post forms. Are these just separate attempts at exporting the same information, or is there another reason for multiple files?

I'll review your responses and we can decide how to proceed.

#504154

Thanks Christian,

1. The Validator (hidden link) threw these errors:
Warning Missing "charset" attribute for "text/xml" document.

The HTTP Content-Type header (text/xml) sent by your web browser (Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36) did not contain a "charset" parameter, but the Content-Type was one of the XML text/* sub-types.

The relevant specification (RFC 3023) specifies a strong default of "us-ascii" for such documents so we will use this value regardless of any encoding you may have indicated elsewhere.

If you would like to use a different encoding, you should arrange to have your browser send this new encoding information.

Error
Sorry, I am unable to validate this document because on line 379 it contained one or more bytes that I cannot interpret as us-ascii (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.
The error was: ascii "\xC2" does not map to Unicode

2. The sites live, will these steps show errors to the site users? (If so I'll need to schedule some down time)

3. Yep, versions 1&2 were attempts without any changes, 3 was after turning off all non-types plugins. I also just tried again without changing anything, no joy.

Really appreciate your help here, again many thanks,

D

#504407

The error was: ascii "\xC2" does not map to Unicode
This seems to indicate some characters that were generated in your XML document are not Unicode-compatible, which may cause an error during import like you are experiencing. Can you provide a copy of this file for me to review? You may upload the file to Dropbox or Drive or some other file sharing service and provide me with a download link here in the private reply.

#504501

Hi, I had some problems uploading the XML file directly, as well, so I compressed the XML file into a zip archive and uploaded the zip. This time, the forms were imported successfully. Can you try this process to see if you are able to import the forms as zip archives instead of XML? In the meantime, I will provide your XML documents to our developers and see what they have to say about the XML failure, and if there are any other potential workarounds.

Please let me know the results of your zip uploads, and I will continue to update you here as I get new information.

#504812

You sir, are a genius. Worked perfectly. (feel a bit stoopid I didn't try this myself!)

#546559

Hi, just a quick update to let you know the importer errors have been fixed in CRED 1.9.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.