Your problem is in the first if-statement:
if ($_FILES["userfile"]["size"] = 0)
You are using an assignment here rather than the comparator == as I think you mean. In PHP though, your statement is legal, just that it will always be evaluated to false (and thus will never cause the code block following it to execute).
As for not getting the error when you upload a 2MB file, I'm not sure what is happening there, especially since 2000000 bytes < 2MB (which is 2 * 2 ^20 = 2 * 1024 * 1024). I would suggest doing the following to see exactly what is happening when you upload a file:
print_r($_FILES);
exit;
Executing this code will print the FILES array and might give you a clue as to why your code is not behaving as you would like.
Hope this has helped,
darkagn :)