$_FILES[“file”][“size”] returning 0?

后端 未结 4 1494
借酒劲吻你
借酒劲吻你 2020-12-18 18:29

I am trying to upload something using PHP and set a limit on the total size that I allow to be uploaded. I want to limit my uploads to 2MB but for some reason whenever I try

4条回答
  •  一整个雨季
    2020-12-18 19:03

    if( $_FILES['file']['size'] && $_FILES['file']['size'] < (2<<20))
    

    Try that.

    << is bitwise shift operator, decimal 2 is binary "10", then add 20 zeros.

提交回复
热议问题