When uploading a very large file in PHP, how much RAM is required on the server?
I read http://www开发者_如何学Go.php.net/manual/en/ini.core.php#ini.post-max-size.
memory_limit must > post_max_size . Then if user upload a file 500MB then how much total RAM use ?
does it use >500MB ?
No, memory_limit need not be greater than post_max_size.
PHP has different POST readers and handlers depending on the content type of the request. In case of "multipart/form-data" (what is used for sending files), rfc1867_post_handler
acts as a mixed reader/handler. It populates both $_POST
and $_FILES
. What goes into $_POST
counts towards the memory limit, what goes into $_FILES
also counts.
However, $_FILES
has just meta-data about the files, not the files themselves. Those are just written into the disk and hence don't count towards the memory limit.
精彩评论