Quantcast
Channel: Lucee Dev - Latest topics
Viewing all articles
Browse latest Browse all 430

Component is taking very large time when file is uploaded

$
0
0

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 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 430

Trending Articles