Check if specific input file is empty

后端 未结 11 735
醉酒成梦
醉酒成梦 2020-11-29 07:23

In my form I have 3 input fields for file upload:





        
11条回答
  •  情话喂你
    2020-11-29 07:48

    You can check if there is a value, and if the image is valid by doing the following:

    if(empty($_FILES['cover_image']['tmp_name']) || !is_uploaded_file($_FILES['cover_image']['tmp_name']))
    {
       // Handle no image here...
    }
    

提交回复
热议问题