|
|||
|
So che propongo un argomento trattato e ritrattato...ma le ho provate tutte e proprio non mi riesce.
Dopo varie ricerche in rete, ho deciso di optare per l'esempio troveto nella guida ufficiale (http://it2.php.net/manual/it/features.file-upload.php)...e neanche questa volta funziona. Posto i codici form Codice:
<FORM METHOD="POST" ACTION="fotografie_aeree_verticali_include.php" enctype="multipart/form-data" name="form1"> <tr height="38"> <td width="400" align="left" height="38" valign="middle"> <h5>Anno Ripresa: <INPUT name="AnnoRipresa" TYPE="Text"id="AnnoRipresa"></h5> </td><td> <h5>Foto:</h5> <input type="file" name="Foto" id="Foto"> </td> </tr> <tr height="38"> <td width="400" align="left" height="38"> <h5>Sensore: <INPUT name="Sensore" TYPE="Text"id="Sensore"></h5> </td> </tr> <tr height="53"> <td width="400" align="left" height="53"> <h5>Regione: <INPUT name="Regione" TYPE="Text" id="Regione"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Provincia: <INPUT name="Provincia" TYPE="Text"id="Provincia"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Comprensorio: <INPUT name="Comprensorio" TYPE="Text"id="Comprensorio"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Comune: <INPUT name="comune" TYPE="Text"id="comune"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Toponimo: <INPUT name="Toponimo" TYPE="Text"id="Toponimo"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Tipo Evidenza: <INPUT name="TipoEvidenza" TYPE="Text"id="TipoEvidenza"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Attestazione Documentaria: <INPUT name="AttestazioneDocumentaria" TYPE="Text"id="AttestazioneDocumentaria"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Interpretazione: <INPUT name="Interpretazione" TYPE="Text"id="Interpretazione"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Affidabilit?: <INPUT name="Affidabilit?" TYPE="Text"id="Affidabilit?"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Definizione: <INPUT name="Definizione" TYPE="Text"id="Definizione"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5>Cronologia: <INPUT name="Cronologia" TYPE="Text"id="Cronologia"></h5> </td> </tr> <tr> <td width="400" align="left"> <h5><INPUT TYPE="SUBMIT" VALUE="Insert"></h5></td> </tr> </form> Codice:
<?php
$db_host="...";
$db_user="...";
$db_password="...";
$db_database="...";
$connessione=mysql_connect($db_host,$db_user,$db_password) or die ("Errore nella connessione al Mysql:" . mysql_error());
mysql_select_db($db_database,$connessione) or die ("Errore nella selezione del db:" . mysql_error());
$uploaddir = './fotografie';
//fotografie corrisponde alla cartella nella quale vorrei fossero salvate le immagini
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "File is invalid.\n!";
}
print_r($_FILES);
$query = "INSERT INTO fotoaereeverticali (AnnoRipresa, Sensore, Regione, Provincia, Comprensorio, Comune, Toponimo, TipoEvidenza, AttestazioneDocumentaria, Interpretazione, Affidabilit?, Definizione, Cronologia, Foto) VALUES
('".$_POST['AnnoRipresa']."', '".$_POST['Sensore']."', '".$_POST['Regione']."', '".$_POST['Provincia']."', '".$_POST['Comprensorio']."', '".$_POST['Comune']."', '".$_POST['Toponimo']."', '".$_POST['TipoEvidenza']."', '".$_POST['AttestazioneDocumentaria']."', '".$_POST['Interpretazione']."', '".$_POST['Affidabilit?']."', '".$_POST['Definizione']."', '".$_POST['Cronologia']."', '".$_FILES['upfile'] ['name']."')";
$Result=mysql_query($query) or die ("Errore nella query:" . mysql_error());
echo "Record inserito con successo";
?>
Codice:
File is invalid. !Array ( [Foto] => Array ( [name] => Intervista CorriereSera.jpg [type] => image/jpeg [tmp_name] => /tmp/phpDanWDa [error] => 0 [size] => 665388 ) ) Record inserito con successo |
![]() |
| Strumenti discussione | |
| Modalità visualizzazione | |
|
|
Discussioni simili
|
||||
| Discussione | Autore discussione | Forum | Risposte | Ultimo messaggio |
| funzioni per immagini | alice1 | PHP | 1 | 21-12-2006 23.18.20 |
| problema con upload immagini | nanolnx | PHP | 0 | 20-11-2006 18.20.16 |
| upload immagini nel DB | alice1 | PHP | 1 | 21-07-2006 10.53.31 |
| Software per immagini | d-web | WEB GRAFICA | 1 | 15-07-2003 23.13.04 |
| Immagini divertenti | interfan | DISCUSSIONI OFF-TOPIC | 2 | 25-05-2003 20.40.23 |