views:

71

answers:

3

I am curious to know how webservers handle file uploads.

Is the entire file sent as a single chunk? Or is it streamed into the webserver - which puts it together and saves it in a temp folder for PHP etc. to use?

+2  A: 

It's just a matter of following the encoding rules so that one can easily decode (parse) it. Read on the specification about multipart-form/data encoding (the one which is required in HTML based file uploads using input type="file").

Generally the parsing is done by the server side application itself. The webserver only takes care about streaming the bytes from the one to the other side.

BalusC
A: 

It's streamed to answer that question, but see this RFC 1867 for more information.

C. Ross
A: 

RFC 1867 describes the mechanism.

Darin Dimitrov