Giorno, non mi funziona il controllo sull'upload del file, cosa c'è di sbagliato?
Codice PHP:
if(isset($_POST['prov'])){ // si viene dal form, si processano i dati
if ($_POST['upload'] != '')
{
$tracciato_temp = $_FILES["tracciato"]["tmp_name"];
$nome = $_FILES["tracciato"]["name"];
$estensioni = array("kml", "gpx");
$estensione_file = substr($nome, strrpos($nome, '.') + 1);
if (!in_array($estensione_file, $estensioni) && ($_FILES["tracciato"]["size"] < 1000) ) {
echo "Files must be .gpx and less than 1MB";
}
else
{
//tutte le operazioni che devo fare
}
else { // è una chiamata diretta quindi mostro il form
?>
<form method="post" action="index.php" enctype="multipart/form-data">
<table border="0" cellspacing="2" cellpadding="4">
<tr>
<td width="167" class="arial">Gpx File:</td>
<td width="151"><input type="file" name="tracciato" size="50" /></td>
</tr>
<tr>
<td class="arial">Track Name:</td>
<td><input type="text" name="titolo" size="50" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="hidden" name="prov" value="form" />
<input type="submit" name="upload" value="Upload" /></td>
</tr>
</table>
</form>
<?
}
?>