Form field [form.uploadimage] is not a file field

I’m trying to troubleshoot this situation:

  • a file is sent from an android client with a post to a cfm page.
  • a cfm tag in the page try to upload it
  • an exception is thrown: form field [form.uploadimage] is not a file field

I don’t have much control on the client.
The same application with Coldfusion is working.
It seems the file is written but it’s not in image format

I use lucee through apache, with a ProxyPass.
I don’t know where else to look…very important to find a solution as it will block migration

was the form set to multipart/form-data?

1 Like

@Zackster, If we not set enctype=“multipart/form-data”, Coldfusion also throws an error as same as lucee. But, did you see @glasnhost above comment? he said Coldfusion is working.

seeing a code snippet might help, was it the first or the second ?




Exactly, CF is working.
here getHttpRequestData():

Native Array (byte)
Raw (truncated) [45,45,42,42,42,42,42,13,10,67,111,110,116,101,110,116,45,68,105,115,11 …truncated]
Struct Entries: 11
accept-encoding string gzip
connection string close
content-length string 84263
content-type string multipart/form-data;boundary=*****
enctype string multipart/form-data
host string
uploadimage string /storage/emulated/0/DCIM/IMAGE.jpg
user-agent string Dalvik/2.1.0 (Linux; U; Android 5.1.1; KFFOWI Build/LVY48F)
x-forwarded-for string
x-forwarded-host string
x-forwarded-server string test.localhost
method string POST
protocol string HTTP/1.1

the only relevant code snippet I’m afraid is this one:

<cffile action="upload" nameconflict="overwrite" filefield="form.uploadimage" destination="/#path#/#filename#">

@glasnhost, Could you please share a stack trace as pic of this issue.

and the corresponding getHttpRequestData from coldfusion

Accept-Encoding gzip
ENCTYPE multipart/form-data
connection Keep-Alive
content-length 114354
content-type multipart/form-data;boundary=*****
uploadimage /storage/emulated/0/DCIM/IMAGE.jpg
user-agent Dalvik/2.1.0 (Linux; U; Android 5.1.1; KFFOWI Build/LVY48F)
method POST
protocol HTTP/1.1

lucee.runtime.exp.ApplicationException: form field [form.uploadimage] is not a file field.
at lucee.runtime.tag.FileTag.getFormItem(
at lucee.runtime.tag.FileTag.actionUpload(
at lucee.runtime.tag.FileTag.doStartTag(
at uploadfoto_cfm$
at lucee.runtime.PageContextImpl._doInclude(
at lucee.runtime.PageContextImpl._doInclude(
at lucee.runtime.PageContextImpl.doInclude(
at lucee.runtime.tag.CFTag.doInclude(
at lucee.runtime.tag.CFTag.cfmlStartTag(
at lucee.runtime.tag.CFTag.doStartTag(
at manage.include.bridge_cfm$
at lucee.runtime.PageContextImpl._doInclude(
at lucee.runtime.PageContextImpl._doInclude(
at lucee.runtime.listener.ModernAppListener._onRequest(
at lucee.runtime.listener.MixedAppListener.onRequest(
at lucee.runtime.PageContextImpl.execute(
at lucee.runtime.PageContextImpl._execute(
at lucee.runtime.PageContextImpl.executeCFML(
at lucee.runtime.engine.Request.exe(
at lucee.runtime.engine.CFMLEngineImpl._service(
at lucee.runtime.engine.CFMLEngineImpl.serviceCFML(
at lucee.loader.engine.CFMLEngineWrapper.serviceCFML(
at lucee.loader.servlet.CFMLServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.tomcat.websocket.server.WsFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.service(
at org.apache.coyote.AbstractProcessorLight.process(
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
at org.apache.tomcat.util.threads.TaskThread$

@glasnhost, Can you please make sure,once again Is coldfusion working correctly or not as per your code?

why is there a leading space between form. and uploadimage?

sorry my wrong, there is no space.
I did find the line in the code, but still I don’t get why formScope().get returns null…what does it mean?

double checked with a colleague, CF 2016 working, CF11 also

@glasnhost, If the uploaded file is not in the form scope means, it’ll throw an error.

yes, but I see it in the form fieldnames…

  <cflog file="#application.logfile#" text="FORM FIELDS: #form.fieldnames#">


"INFO","http-nio-8888-exec-9","01/22/2020","16:55:13","","FORM FIELDS: uploadimage"

Local/production lucee machine:
Using: Lucee
On Macos/Centos

oh, can you reproduce the problem on the latest release or snapshot?

@glasnhost, OK fine. Could you please add this condition?

<cfif structKeyExists(form,"uploadimage")>
      <cffile action="upload" nameconflict="overwrite" filefield="form.uploadimage" destination="/#path#/#filename#">

I think, it’ll be solve your issue.

"INFO","http-nio-8888-exec-3","01/22/2020","17:10:23","","key exists!!!!"
"INFO","http-nio-8888-exec-3","01/22/2020","17:10:23","","error form field [form.uploadimage] is not a file field. nomefile:GUASTO1579709423036.jpg log:/storage/emulated/0/DCIM/GUASTO1579709423036.jpg"