Salve a tutti,
sto inserendo delle immagini(tramite una form) utilizzando il seguente script:
$path = "C://Users/fili/Desktop/vicotour/alloggi/";
$max_size = 200000;
if (!isset($HTTP_POST_FILES['foto'])) exit;
if (is_uploaded_file($HTTP_POST_FILES['foto']['tmp_name'])) {
if ($HTTP_POST_FILES['foto']['size']>$max_size) { echo "File troppo grande
\n"; exit; }
if (($HTTP_POST_FILES['foto']['type']=="image/gif") || ($HTTP_POST_FILES['foto']['type']=="image/pjpeg") || ($HTTP_POST_FILES['foto']['type']=="image/jpeg")) {
if (file_exists($path . $HTTP_POST_FILES['foto']['name'])) { echo "Il file esiste già
\n"; exit; }
$res = copy($HTTP_POST_FILES['foto']['tmp_name'], $path .
$HTTP_POST_FILES['foto']['name']);
if (!$res) { echo "upload failed!
\n"; exit; } else { echo "upload sucessful
Torna indietro\n"; }
echo "File Name: ".$HTTP_POST_FILES['foto']['name']."
\n";
echo "File Size: ".$HTTP_POST_FILES['foto']['size']." bytes
\n";
echo "File Type: ".$HTTP_POST_FILES['foto']['type']."
\n";
} else { echo "Wrong file type
\n"; exit; }
}
il problema è che non capisco come inserire il percorso del file nel database(precisamente nel campo 'foto' di tipo VARCHAR).
Qualcuno può postarmi il codice per l'inserimento o darmi istruzioni precise in merito?
Grazie