I came across this piece of code where programmer determines uploaded file size like this:
$file_size = @filesize($_FILES[$upload_name]["tmp_name"]);
AFAIK one can simply do:
$_FILES[$upload_name]["size"];
Are there reasons to use filesize() function over reading file size from $_FILES array?
This is populated for you by PHP after receiving the uploaded file.
This is a wasteful method that goes out and gets the file size from the drive, even though it’s already populated inside
$_FILES[$upload_name]["size"].