Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Cannot re-assign auto-global variable

Tags:

php

Fatal error: Cannot re-assign auto-global variable _FILES in C:\xampp\htdocs\user\utils\CommonUtils.php on line 1395

The code on line 1395 is

public static function saveAvatar($code, $pilotid, $_FILES) {
like image 972
sandeep Avatar asked Dec 05 '22 12:12

sandeep


1 Answers

you can't use $_FILES for function parameter it's reserved word, use this instead of

public static function saveAvatar($code, $pilotid, $files) { }

and for calling pass the $_FILES like this

saveAvatar($code, $pilotid, $_FILES);

OR

You can also directly access the $_FILES without passing it in function parameter inside function.

like image 97
Yogesh Suthar Avatar answered Dec 09 '22 16:12

Yogesh Suthar