It appears that when I use an html form to make a "Content-Type: multipart/form-data" POST request, the fields always appear in the order in which they are listed in the HTML. In practice, do all browsers do this?
The primary motivation for wanting to know this is so I can do server-side validation of form data w/o being required to cache the entire HTTP request in RAM | disk first.
I know CGI, PHP, etc typically won't do anything 'til the upload completes. Probably because RFC 2388 section 5.5 addresses this issue by saying the order is not defined. I'm working w/ a highly customized fork of thttpd and handling the upload w/ C code built right into the server. So I don't care what most servers do.
What I want to know, is if I go out on a limb and assume an order, will I get burned by that assumption?
Take this form for example:
<form id="formUpload"
target = "uploadTarget"
method = "post"
action = "/bin/upload"
enctype= "multipart/form-data" >
<input type="hidden" id="inUser" name="user" />
<input type="hidden" id="inDest" name="dest"/>
<input type="file" id="inFile" name="file" />
<input type="button" value="Upload" onclick="uploadFile();" />
<iframe id="uploadTarget" name="uploadTarget" src="" style="width:0;height:0;border:0px"/>
</form>
The 'uploadFile()' function will fill in the user & dest fields before invoking submit(). I would like to validate user & dest server side as well, before recv()
-ing the entire HTTP request body.