Cffile - mimetype of uplaoded csv incorrect (?) in 5.2.x


#1

it might related to

https://luceeserver.atlassian.net/browse/LDEV-390
https://luceeserver.atlassian.net/browse/LDEV-1549

We upload csv file using code like

<cfif structkeyexists(form, "upfiles")>
do upload.
	<cfset destDir = "c:/temp/">

	<cffile action="upload" filefield="upfiles" destination="#destDir#" result="uploadResult" nameconflict="overwrite" accept="text/csv,application/vnd.ms-excel">
	<cfdump var="#uploadResult#">
	
	<cfexit>
</cfif>
<cfoutput>
<form id="form1" action="" enctype="multipart/form-data" method="post">
<input type="file" name="upfiles" id="upfiles" multiple="multiple" /><br /><br />
<input type="submit" name="submit" value="Upload" />
</form></cfoutput>

in Lucee 4.5
contentsubtype - vnd.ms-excel
contenttype - application

In ACF 2016
CONTENTSUBTYPE - csv
CONTENTTYPE - text

However, now in Lucee 5.2.x
it is ‘text/plain’, and cffile will stop uploading.

Detail string only this [text/csv,application/vnd.ms-excel] mime type are accepted
ErrorCode string 0
Extended_Info string
ExtendedInfo string
Message string The MIME type of the uploaded file [text/plain] was not accepted by the server.
StackTrace string lucee.runtime.exp.ApplicationException: The MIME type of the uploaded file [text/plain] was not accepted by the server.
at lucee.runtime.tag.FileTag.checkContentType(FileTag.java:1038)
at lucee.runtime.tag.FileTag._actionUpload(FileTag.java:889)
at lucee.runtime.tag.FileTag.actionUpload(FileTag.java:813)


#2

This is what I use.

< cffile action=“upload” fileField="#form.file#" destination="/path/to/file" nameConflict=“MakeUnique”/>
< cfset fileext = cffile.clientfileext>
< cfif fileext eq ‘jpg’ or fileext eq ‘png’ or fileext eq ‘pdf’ or fileext eq ‘jpeg’>
< cffile action=“rename” source="/path/to/file/#session.sid#/#cffile.serverfile#" destination="/path/to/file/#session.sid#/#cffile.clientfile#" attributes=“normal”/>
< /cfif>


#3

Hi @Allen_Weng,

I’ve tested this on ACF and Lucee & Issue is fixed on latest Lucee 5.2.9.17-SNAPSHOT version, Now it is working as expected.

contentsubtype - csv
contenttype	- text

Can you please check with latest version & Let me know if still issue is reproduced .


#4

Thank you. I have verified it is working in Lucee 5.2.9.18-SNAPSHOT - will this fix be part of 5.2.8 release ??