Skip to main content
October 26, 2012
Question

Invalid Mimetype Detection for .xls file with CF10

  • October 26, 2012
  • 3 replies
  • 11120 views

After upgrading to CF10, we are having issues getting our server to properly recognize any mimetype associated with the .xls file extension.  For some odd reason, the server is viewing them as a word file type and rejecting it.   

When we upload a file with the .xls extension, the server responds back with the following error message:

"The MIME type or the Extension of the uploaded file application/msword was not accepted by the server. Only files of type application/excel,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet can be uploaded. Verify that you are uploading a file of the appropriate type. The error type is Application."

Our only workaround for the time being is uploading all files in the newer .xlsx format, which the server properly accepts.  As you will see from the above error message, those are the mimetypes I have thus far.  The other work around is updating the tika jar files which I have included more details in my bug report link below, but that is a solution we are steering off of until we get further confirmation on the solution. 

I've reported this possible bug to Adobe, but of course it will be weeks or months before a confirmation or response is made on it since there are countless other bugs / feature requests that are still unanswered.  So I'm reaching out to the community in efforts to see if anyone else may have received the same issue or could see what we may be doing wrong. 

Link to bug report with more details: https://bugbase.adobe.com/index.cfm?event=bug&id=3343364

This topic has been closed for replies.

3 replies

July 26, 2013

In attempting to tighten our uploads, we also have run into this problem. I was able to work around the problem thanks to this writeup. I made sure that I accepted both excel and msword if the type of file being uploaded was excel. Then after the call to this function, I needed to manually change the file type to excel before continuing the upload.

It works ok, but the bug really should be investigated and fixed. I have no idea what happened to your bug report, but it is no longer accessible.

July 26, 2013

This error should no longer be occuring, at least it does not for us. I'm guessing Adobe fixed it or it is from one of the more recent Java updates.

You might be able to fix it on your end by updating to the most recent version of CF or updating to the following java versions, which we have installed on our production server:

Java 7 Update 25 (64-bit)

Java SE Development Kit 7 Update 17 (64-bit)

Java SE Development Kit 7 Update 25 (64-bit)

Java 6 Update 39 (64-bit)

Java SE Development Kit 6 Update 38 (64-bit)

Java SE Development Kit 6 Update 39 (64-bit)

July 29, 2013

Thank you for this information. We updated our development server this

morning and the problem was corrected. Now all we have to do is figure out

when we can update the production servers in order to get the correction!

Glenda

Tim Cunningham
Participating Frequently
January 18, 2013

As a possible work around until, the CF team fixes this issue you could use magicmime from riaforge.

http://magicmime.riaforge.org/

Similar to how Linux/Unix check the contents of a file to determine their type, instead of using the file extension, this CF function performs a similar task.

Simple CFFUNCTION that returns a structure detailing the filetype/mimetype etc.

Currently supports:-

Adobe PDF Document

Microsoft Office Open XML Format Document

Microsoft Office Open XML Format Spreadsheet

Microsoft Office Open XML Format Presentation

Microsoft Office Word 97-2003 Document

Microsoft Office Excel 97-2003 Document

Microsoft Office Powerpoint 97-2003 Document

Graphics interchange format Image

Portable Network Graphics Image

JPEG Image

HTML (Experimental)

Carl Von Stetten
Legend
October 26, 2012

May seem like a stupid question, but: are you absolutely sure the file you are uploading is actually an Excel file and not a Word file that got renamed to .XLS?  The reason I ask is that with CF10, CF no longer just looks at file extensions to determine MIME type - it sniffs the file headers to determine type.

-Carl V.

October 26, 2012

Yes, when a user reported the issue that is the first thing I did to test and replicate the issue. 

First Replication Process:

Open Microsoft Excel --> Enter any data --> Save as Excel 97-2003 Workbook (*.xls)

Upload --> Invalid Mimetype Detection Error Returned

We have a catch to detect a blank file as well, it does not even get to that point.  :-)

Second Replication Process:

Open Microsoft Excel --> Enter no data (blank file) --> save as Excel 97-2003 Workbook (*.xls)

Upload --> Invalid Mimetype Detection Error Returned

Carl Von Stetten
Legend
October 26, 2012

OK.  Just wanted to eliminate that.  Hopefully someone else will chime in.

-Carl V.