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

前端 未结 5 1826
情书的邮戳
情书的邮戳 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条回答
  •  旧时难觅i
    2021-01-04 12:25

    The best way, assuming you're using a recent PHP (4.2+), is to check that:

    $_FILE['myfilename']['error'] === UPLOAD_ERR_OK
    

    If this is true the upload worked, you can see the list of other possible values here

提交回复
热议问题