what is the meaning and purpose of this:
It is a way to check if files were uploaded during the request (via
<input type="file"> in a form or similar). When files are uploaded, information about those files is stored in the $FILES variable, which is an array. If no files are uploaded the array is empty and `if ($FILES)
would not fire (since an empty array cast to a boolean isfalse
). If files are uploaded the array would contain values andif ($_FILES)
would fire (since any non-empty array cast to a boolean istrue`).
Better would be (IMHO):
if (count($_FILES) > 0) (because I don't like implicit casting)
This topic is now closed. New replies are no longer allowed.