function add()
{
$file = new file();
$img = $file->add($this->tmp_name, $this->name);
$p = $file->resampimagejpg(150,150, "files/".$img, "files/imgs/".$img, 0);
$sql = new sql($this->table);
$w = array("type", "obj", "catcid", $this->catid);
$sql->waddeq($w);
$sql->field = "id";
$maxid = $sql->max();
$maxid ++;
$sql->fields = array("id", "type", "catcid", "foto");
$sql->values = array($maxid, $this->type, $this->catid, $img);
$sql->insert();
}
На работе ))