AJAX issue – Uncaught SyntaxError when processing Zip File

I’m creating an application that will allow a user to fill out a form and then have a customized zip file downloaded for them upon submit. I’m utilizing AJAX to accomplish this task. Build.prototype.ajaxHandler = function(method, values) { jQuery.ajax({ type: ‘POST’, url: WP_LOCALIZED[‘url’], data: { action: ‘request_handler’, method: method, data: values }, success: function(data) { … Read more

How do you use unzip_file()?

I have been trying to use the unzip_file() function. It says undefined so I looked into it and the WP_Filesystem() must be called and set up. So easy, right? require_once(ABSPATH .’/wp-admin/includes/file.php’); WP_Filesystem(); unzip_file( $zip, $dest ); Even this shows as undefined, and I don’t see any documentation on it. I am trying to use the … Read more

How to assign multiple file-mime-types to extension?

To allow extra file types for upload, we use: add_filter(‘mime_types’, ‘my_mimes’); function my_mimes($all) { $all[‘zip’] = ‘application/zip’; return $all; } But how to assign multiple file types to 1 extension? For example, zip extension might have application/zip mime and also application/x-zip (like, coming from 7zip). This way doesn’t work: $all[‘zip’] = [‘application/zip’, ‘application/x-zip’] ; 3 … Read more