I think there's a couple of problems with your script.
First when you write this:
<?
if($img1=new image('test1'))
{
?>
what you are doing is testing whether the object $img1 exists.
Whether the constructor returns false or not, the object will still be created, so that statement will return true.
At least, that is my understanding anyway.
As well this section in the constructor doesn't look right:
if($this->size>$MAXSIZE)
{
$this->error.="File is too large\n";
return false;
}
What is $MAXSIZE? It is not defined anywhere in the function.
If it is a global variable you will need to reference it:
global $MAXSIZE
Hope that helps,
-Adam 🙂