How to prevent Warning: POST Content-Length and memory size

前端 未结 7 614
慢半拍i
慢半拍i 2020-12-10 14:46

Currently when user uploads a photo the page says \"Warning: POST Content-Length of XXX bytes exceeds the limit of 21000000 bytes in Unknown on line 0\".

I

7条回答
  •  爱一瞬间的悲伤
    2020-12-10 15:09

    Here is the REAL solution to prevent this error properly.

    Set this parameters in your php.ini :

    enable_post_data_reading = On
    upload_max_size=0
    post_max_size=0
    

    Warning : be sure to have this line in your form

    
    

    AND the MOST IMPORTANT :

    • be sure to check the code errors of $_FILES['file']['error']

    • be sure to check size of your upload in PHP too

提交回复
热议问题