When we submit a form on cfc page, it takes a long time compared to cfm page.
To test here is the file:
- 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>
- Create uploadAction.cfm page with no content
- 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