But how does CGI.content_length know which file you're planning
to upload?
The Common Gateway Interface(CGI) is a standard means of
communication between browsers, HTTP, web and other types of
servers. The technologies may be different, but CGI enables them to
pass to each other common information that is useful to all. CGI
variables are an example of such information.
When the browser makes a request, like posting the upload
form, the server automatically populates the variables in CGI scope
with information that pertains to the request. CGI.content_length
is one such piece of information. It is just information about the
request, and is available to Coldfusion, even without Coldfusion
actually executing <cffile action="upload"...>. To see that
in action, run the following code: