Component is taking very large time when file is uploaded

When we submit a form on cfc page, it takes a long time compared to cfm page.

To test here is the file:

  1. Create uploadFile.cfm page with following content
<html>
	<body>
		<input type="file" name="file1" id="file1" />
		<br />
		
		<button onclick="file1Upload()">
			Upload to cfm page
		</button>
		
		<button onclick="file2Upload()">
			Upload to cfc page
		</button>
		<script>
			function file1Upload() {
				let field = document.getElementById("file1").files[0];
				let formData = new FormData();
				formData.append("file", field);
				fetch('/uploadAction.cfm', {method: "POST", body: formData});
			}
			function file2Upload() {
				let field = document.getElementById("file1").files[0];
				let formData = new FormData();
				formData.append("file", field);
				fetch('/uploadAction.cfc?method=uploadFile', {method: "POST", body: formData});
			}
		</script>
	</body>
</html>
  1. Create uploadAction.cfm page with no content
  2. Create uploadAction.cfc page with following content
<cfcomponent displayname="uploadAction" output="false">

	<cffunction name="uploadFile" access="remote">
		<cfreturn {"status": "done"} />
	</cffunction>

</cfcomponent>

Now upload 10 MB pdf file, For me it takes 119ms for cfm page, and cfc calls times out.

OS: Windows 11
Java Version: JRE 1.8
Tomcat Version: Apache Tomcat 9.0.11
Lucee Version: 5.4.5.23

1 Like

Same problem here, downgrade is the only option ar this time.

Sounds more like a tomcat setting.

under the connector setting in server.xml

maxPostSize=“104857600”
maxSwallowSize=“104857600” />

That will set the file size to 100 m and the post size to 100 mb

after you change the setting restart tomcat.

1 Like

Tried your code with both lucee-express-5.4.6.9 and lucee-express-6.0.1.83, but it seems to work for me.
As I didn’t have a 10MB file at hand, I used the PowerShell snippet from this SO question to create a 15MB file.

Extended the uploadAction.cfc and uploadAction.cfm with:

<cffile action="upload" destination="#expandPath('./')#" filefield="form.file" nameconflict="makeunique">

And then used the form to upload the file and it appears in the same directory, both take nearly the same amount of time 150-250ms.

No, i’ve tried it… it happens only with .cfc files. Dowgrading Lucee problem disappear.

@vikaskanani thankfully already created a ticket. Status still “new”

https://luceeserver.atlassian.net/browse/LDEV-4898

1 Like