Coldfusion CSV upload returns mime-type error with mime-type / text / plain '

I'm having trouble with ColdFusion 10. The code is working, I'm not sure what changed where - the code itself hasn't changed for months in this area.

I have a cffile that looks like this:

<cffile action="upload" filefield="fileLocation" 
    destination="#destination#" 
    nameConflict="Overwrite" 
    accept="application/vnd.ms-excel,text/csv" 
    result="upload">

      

I have a .csv file that I am downloading. The error I receive is this (cfcatch.message and then cfcatch.detail):

The MIME type or the Extension of the uploaded file text/plain was 
not accepted by the server. 

Only files of type application/vnd.ms-excel,text/csv can be uploaded. 
Verify that you are uploading a file of the appropriate type.

      

In Firebug, the Post part for Net entry looks like this:

Content-Disposition: form-data; name="fileLocation"; filename="myfilename.csv"
Content-Type: application/vnd.ms-excel

      

If I take away the accept = "" attribute and then cfdump # upload #, I get:

CONTENTSUBTYPE  vnd.ms-excel
CONTENTTYPE     application 

      

Or in other words, CF gets the /vnd.ms-excel app that Firefox sends. And still. The mime type it outputs is text / equal.

I checked the file - it's in CSV format, the same one that was uploaded just fine before. I renamed the file to .txt and then reverted back to .csv, just in case it was an extension related issue. The same error. I have verified that I do not have an open file.

My user is using our production server to try this. I am using our development server. So whatever it is, it is not specific to one server.

Does anyone have any idea why this is happening with text / plain? I would vaguely understand this if it was receiving an app / octet stream; text / plain is just ... confusing.

+3


source to share


1 answer


Decision:

Place the strict = "false" attribute on the tag <cffile>

.



Even if the default is considered false, put it strict anyway, rather than relying on the default.

Also review this for other CF10 changes in cffile: https://wikidocs.adobe.com/wiki/display/coldfusionen/cffile

0


source







All Articles