how to check if a $_FILE is set in php?

前端 未结 5 1863
情书的邮戳
情书的邮戳 2021-01-04 12:01

I\'ve created a form with 3

I see that I get an array with array(name=>\"\").

So I check if (

5条回答
  •  青春惊慌失措
    2021-01-04 12:20

    You can use empty to check if a variable is blank or not but Pekka's solution is best in this way

    if (empty($_FILES["myfilename"]["name"]))
    

    If you are checking that if a variable is set you can use isset function

提交回复
热议问题