I'm trying to allow users to upload large files (64MB) and am planning to change upload_max_filesize to 64MB.
However, should I also change memory_limit to 64MB or larger?
Is memory_limit connected to upload_max_filesi开发者_开发知识库ze?
No, it's not necessary.
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.
post_max_size must be bigger than upload_max_filesize. If a form contains more file uploads then the post_max_size must be greater than the sum of them.
The memory_limit does not have any significant role in file uploads, as uploaded files are stored in the /tmp (Linux) directory, not in memory. If you want to submit large amount of data with form fields (not file uploads) then you need a big memory_limit otherwise not.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论