dovresti implementare questo codice, all'ncirca...
codice:
<?php
include("dati.php");
$link=mysql_connect("$db_host","$db_login","$db_pass")
or die ("Non riesco a connettermi a [b]$db_host");
@mysql_select_db ($database, $link)
or die ("Non riesco a selezionare il db $database
");
if (isset($_REQUEST['nome'])){
// upload dell'immagine di sfondo
$abpath = "percorso assoluto senza slash alla fine";
if(!is_dir($abpath))
{
mkdir($abpath, 0755);
$dir_ID=$abpath."
";
}
$sizelim = "yes"; // qui puoi dare un limite alla grandezza dell'immagine..
$size = "66560";
$tipo1 = "image/pjpeg"; //Jpeg tipo 1
$tipo2 = "image/jpeg"; //Jpeg tipo 2 puoi aggiungerne altri ma sotto devi mettere gli if relativi
if ($_FILES['image']['name'] != "")
{
$uploadfile = $abpath."/".$_FILES['image']['name'];
move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile);
}
if ($_FILES['image']['name'] == "") {
$logfoto1= "<td colspan=\"3\" class=\"style5\"></td>";
}
if ($_FILES['image']['name'] != "")
{
if ($sizelim == "yes")
{
if ($_FILES['image']['size'] > $size)
{
$logfoto1= "<td colspan=\"3\" class=\"warnings\">The file size is too big</td>";
}else{
if (($_FILES['image']['type'] == $tipo1)or ($_FILES['image']['type'] == $tipo2))
{
$uploadfile = $abpath."/". $_FILES['image']['name'];
if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile))
{
$logfoto1= "<td colspan=\"3\" class=\"style5\">file uploaded succesfully</td>";
}
else {$logfoto1= "<td colspan=\"3\" class=\"style5\">file not uploaded </td>";}
} else {$logfoto1="<td colspan=\"3\" class=\"warnings\">The file doesn't seems to be an image</td>";}
}}}
$dati=" INSERT INTO rubrica VALUES (NULL,
'".$_REQUEST['nome']."',
'".$_REQUEST['cognome']."',
'".$_REQUEST['reparto']."',
'".$_REQUEST['stipendio']."',
'".$_FILES['image']['name']."'
)";
mysql_query ($dati, $link)
or die ("Non riesco ad eseguire la query $dati");
Echo "I Dati sono stati archiviati con successo nel DataBase $database";
mysql_close ($link);
echo "<meta http-equiv=refresh content=3;url=$PATH_INFO>";
}
?>
<?php echo $logfoto1 ?>
devi creare un campo di tipo file chiamato image
prova perchè l'ho corretto a mano...