未定义的变量HTTP_POST_FILES错误

I am writing an upload file code but when I run, it says: undefined variable: HTTP_POST_FILES How can I solve this?

$a=$HTTP_POST_FILES['ufile']['name'];

Did you set the register_global directive to ON in your PHP configuration ?

Plus try using $_FILES instead of $HTTP_POST_FILES, as this last one in now getting old

That just means you DID NOT define $HTTP_POST_FILES

Define it and you should be good.


If you are trying to use the now deprecated $HTTP_POST_FILES, don't.
Use $_FILES instead.