The expression $size << 10shifts the bit pattern to the left 10 times, effectively multiplying by 1024; In other words, this $size * 1024.
Each time you do a left shift, you double the value. See also bitwise operators .
If you want to $sizemean the 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";
}
source
share