il mio codice è questo



if ($_FILES["immagine"]["error"] == 0) // file caricato correttamente
{
if (is_uploaded_file($_FILES["immagine"]["tmp_name"]))
{
$estensione = explode('.', $_FILES["immagine"]["name"]);
if ($estensione[1] == $ext)
{
.
.
.
if (move_uploaded_file($_FILES["immagine"]["tmp_name"], $path.$fileName))
{
$query = "INSERT INTO .......";
$result = mysql_query($query);
$num = mysql_affected_rows();
$id = mysql_insert_id();
if ($num != -1)
echo 'OK';
else if ($num == -1)
echo 'KO';
}
}
else
KO\n';
}
}
else if ($_FILES["immagine"]["error"] == 1) //Il file inviato le dimensioni specificate nel upload_max_filesize di php.ini
$_SESSION['msgAlert'] .= $toysAdmin['filesError']['1'].'\n';
else if ($_FILES["immagine"]["error"] == 2) // Il file inviato eccede le dimensioni specificate nel MAX_FILE_SIZE del form.
$_SESSION['msgAlert'] .= $toysAdmin['filesError']['2'].':\n';
else if ($_FILES["immagine"]["error"] == 3) // Valore: 3; Upload eseguito parzialmente
$_SESSION['msgAlert'] .= $toysAdmin['filesError']['3'].':\n';
else if ($_FILES["immagine"]["error"] == 4) // Valore: 4; Nessun file è stato inviato
{
//$_SESSION['msg'] .= $msgConfig['startKO'].$toysAdmin['filesError']['4'].$msgConfig['end'];
//$_SESSION['msgAlert'] .= $toysAdmin['filesError']['4'].':\n';
}