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

前端 未结 5 1862
情书的邮戳
情书的邮戳 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:30

    Try this:

    if($_FILES["uploadImg"]['name'][0] != ''){
        //echo 'file attached';
    }else{
        //echo 'no file attached';
    }
    

    This works for me...

提交回复
热议问题