So, I\'m uploading a file, and then downloading it... but the Content-Length in the upload headers do not match the file size. I\'m guessing there is some other data involve
I think that each section of the multipart/form-data request counts toward the overall size of the main Content-Length header.
Found this as a reference: http://chxo.com/be2/20050724_93bf.html
So, perhaps after your headers, you might have:
----WebKitFormBoundaryeoFyqD4zr6smwYDG
Content-Disposition: form-data; name="file"; filename="testfile-downloaded.zip"; size=<file size could be here>
Content-Length: <file size could also be here>
<some other content headers>
<file data>
----WebKitFormBoundaryeoFyqD4zr6smwYDG
All of which would count toward the Content-Length size.
EDIT
Just realized I didn't answer your question. Not sure how to pull out the file size from the file section of the request. Sorry!
The data you received is always bigger than you file. Just scan the "boundary" value for the starting and ending of the file.
The reference: How does HTTP file upload work?