The expression $size << 10
shifts the bit pattern to the left 10 times, effectively multiplying by 1024; In other words, it's $size * 1024
.
Every time you perform a left shift, you multiply the value by a factor of two. See also bitwise operators.
If you want $size
to mean size in MB, you multiply by another 1024, i.e.
if ($filesize($file) > $size * 1024 * 1024) {
echo "file too big";
}
Or:
if ($filesize($file) > $size << 20) {
echo "file too big";
}