buonasera a tutti..
ho un sito su ARUBA.IT e non riesco a caricare i file dal mio pc al server tramite un form (usanto il campo di tipo "file")!
il mio form:
codice:
<form action="<? echo $PHP_SELF; ?>" method="post" enctype="multipart/form-data">
<font class="bianco">Invia una foto:</font>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<? echo $grandezza; ?>">
<? if($totalRows_foto1) { echo "<input type=\"hidden\" name=\"esistente\" value=\"1\">"; }?>
<INPUT NAME="upfile" TYPE="file" size="40">
<font color="#FF9900" size="-1">NB: inserire solo foto il cui nome <u>non</u> presenti caratteri speciali all'interno</font>
<center>
<font class="bianco">Inserisci un commento alla foto: </font>
<textarea name="commentone" cols="30" rows="3" wrap="virtual"><? echo $fototesto;?></textarea>
</center>
<INPUT TYPE="submit" VALUE="Invia file">
<input name="Button" type="button" onClick="MM_goToURL('parent','campionato.php?squadra=modifica&NumCampionato=<? echo $campionato;?>&NumTorneo=<? echo $torneo;?>&NumSquadra=<? echo $squadra;?>');return document.MM_returnValue" value="Torna indietro">
</FORM>
il codice di invio del file:
codice:
<?
if(!isset($_FILES)) $HTTP_POST_FILES = $HTTP_POST_FILES;
if(!isset($_SERVER)) $_SERVER = $HTTP_SERVER_VARS;
$errorefile=0;
$MAX_FILE_SIZE=$grandezza;
mysql_select_db($database_eureka, $databaseSerio);
$query_fotocancella="SELECT * FROM fotoModelli WHERE squadra='$squadra'";
$fotocancella=mysql_query($query_fotocancella,$databaseSerio) or die(mysql_error());
$row_fotocancella=mysql_fetch_row($fotocancella);
$file_name_delete=$row_fotocancella['foto'];
if($upfile)
{
$nomefile=$HTTP_POST_FILES["upfile"]["name"];
$typefile=explode(".",$nomefile);
$query_nome1=mysql_query("SELECT * FROM squadre WHERE cont='$squadra'",$databaseSerio);
$query_nome=mysql_fetch_assoc($query_nome1);
$nomefile=$query_nome['alias'];
$nomefile=substr($nomefile,0,20);
$nomefile=str_replace(" ","",$nomefile);
$datafile=date(y).date(m).date(d).date(H).date(i).date(s);
$new_name=$nomefile.$datafile.".".$typefile[1]; echo $new_name;
$file_name=($new_name) ? $new_name : $HTTP_POST_FILES["upfile"]["name"];
if(@is_uploaded_file($HTTP_POST_FILES["upfile"]["tmp_name"])) { @move_uploaded_file($HTTP_POST_FILES["upfile"]["tmp_name"], "$uploaddir/$file_name") or $errorefile=1; }
else { $errorefile=2; }
if($esistente) $foto=mysql_query("UPDATE foto SET foto='$file_name' WHERE squadra='$squadra'",$databaseSerio) or die(mysql_error());
else $foto=mysql_query("INSERT INTO foto SET foto='$file_name' WHERE squadra='$squadra'",$databaseSerio) or die(mysql_error());
}
//CARICAMENTO COMMENTO
if(!$esistente) $foto=mysql_query("INSERT INTO foto SET squadra='$squadra',commento='$commentone'",$databaseSerio) or die(mysql_error());
else $foto=mysql_query("UPDATE foto SET commento='$commentone' WHERE squadra='$squadra'",$databaseSerio) or die(mysql_error());
?>
<center>
<? if(!$errorefile) {?><font class="bianco">Complimenti
Hai aggiornato la foto della squadra</font><? } else {?>
<font class="bianco"><? echo $errorefile; ?>Complimenti
Hai aggiornato il commento, ma si sono verificati degli errori sull'invio della foto</font><? }?>
</center>
<center>
Torna indietro
</center>
come mai non riesco a mandarlo e mi errore nell'invio del file?