i don't know if the code is right but MAX FILE SIZE don't work 

and don't che if file exist or not, maybe i've wrong implemented
isset or there are something in the code. 

p.s. give me this error:

Notice: Undefined variable: content in ecc../ecc. on line 23

Notice: Undefined variable: fp in ecc../ecc. on line 24

here is the code:

```
<?php
interface ICheckImage {

         public function checkImage();

}           
abstract class ACheckImage implements ICheckImage {

         public $fileName;
         public $tmpName;
         public $filesSize;
         public $fileType;
         public $fp;
         public $conent;
         protected $mysqli; 

         public function __construct(){

             $this->fileName = $_FILES['userfile']['name'];
             $this->tmpName  = $_FILES['userfile']['tmp_name'];
             $this->filesSize = $_FILES['userfile']['size'];
             $this->fileType = $_FILES['userfile']['type'];
             $this->content = $content;
             $this->fp = $fp;
             $this->mysqli = new mysqli('localhost','root','root','test');

            }
    }           
class Check extends ACheckImage {

         public function checkImage(){

             if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0){

                 $this->fileName = $_FILES['userfile']['name'];
                 $this->tmpName  = $_FILES['userfile']['tmp_name'];
                 $this->filesSize = $_FILES['userfile']['size'];
                 $this->fileType = $_FILES['userfile']['type'];

                 $this->fp      = fopen($this->tmpName, 'r');
                 $this->content = fread($this->fp, filesize($this->tmpName));
                 $this->content = addslashes($this->content);
                 fclose($this->fp);

                 if(!get_magic_quotes_gpc()){

                     $this->fileName = addslashes($this->fileName);

                    }

                 if ($this->mysqli->query("INSERT INTO upload_images (name, size, type, content ) ".
                      "VALUES ('$this->fileName', '$this->filesSize', '$this->fileType', '$this->content')")){

                         echo "Upload avvenuto &nbsp";

                    }else{

                         echo "Errore &nbsp" . $this->mysqli->error; 

                        }   
                }
            }           
    }

$form = new Check();
$form->checkImage();    

?>

```