You have the validation code before the upload code. It can't check the file size or extension through the webassist bindings before it is uploaded.
You could try using the $_FILES array directly. The size should be: <?php echo($_FILES['PgMainPic']['size']); ?>
And then you can probably use: <?php echo($_FILES['PgMainPic']['type']); ?>
it should have the value: image/jpeg