Unable to upload specific .zip file type via frontend in WordPress 4.0

*I thought I will write this as an update but then I thought it is better to provide the solution as an answer because someone may skip the solution in the question update.

There is no mistake in my code or in the loop for that matter. This is not a server misconfiguration either. As a part of debugging I was echoing back the uploaded filetypes and I realized that when I upload a .zip file it returns as application/x-zip-compressed instead of what I thought should be application/zip. So a small change in the code did the job.

$allowed_file_types = array('application/x-zip-compressed', 'other file types......');

Above works fine now, also to note the .rar file has to be application/x-rar-compressed. I wish it was mentioned on the relevant codex page. I am still sure that this is something that came along with wordpress 4.0. Thanks to @ialocin and @aifrim and others for help.

Leave a Comment