I had a quick glance through, and unless PHP has changed since i last dabbed with it,
PHP Code:
if(($filesize > $MaxFileSize) | $filesize = 0 ) {
should be
PHP Code:
if(($filesize > $MaxFileSize) || $filesize == 0 ) {
As in PHP or is || not |, and you're also not checking if the filesize is 0 by using "=" this is the assignment operator, you need ==.
Edit:
You've also done it here:
PHP Code:
if( $error = 1 ) {
make it
PHP Code:
if( $error == 1 ) {
Though I don't see why you're doing it like this, using integers rather than booleans.