未定义的变量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'];

我正在写一个上传文件代码,但是当我运行时,它说:未定义的变量:HTTP_POST_FILES 我该如何解决? 这个? p>

  $ a = $ HTTP_POST_FILES ['ufile'] ['name']; 
  code>  pre> 
  div>

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.