Upload field accepting some xlsx files but rejecting other xlsx files [RESOLVED]

We have upload fields on a lot of our sites that are used for uploading spreadsheets. We don’t have any restrictions on these fields, so technically, the user can upload any default accepted file type, but the files are predominantly csv, xlsx and xls files.

A user informed us that the upload field wasn’t taking her xlsx files. She sent us the files, and I tried. It’s throwing an error… but when I resaved the files with different names, it took them.

Thoughts as to why? Corrupt files, possibly?

Try getting ahold of one of the problematic files and run it through a MIME type checker. The MIME type might differ from the actual extension, WordPress often doesn’t like that.


Bingo! It’s returning that they’re zip files. We have a couple of sites that have upload fields but use the API. Those fields only allow the xlsx, xls or csv files, but the forms are allowing them to submit because, technically, they have the correct file extensions. Looks like I’ll need to add a mime check as an additional validation for those fields. Thanks for your help!! :slight_smile:

1 Like
© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.