Grazie
premesso che capisco di asp , ma paraticamente zero di PHP vorrei sapere è possibile modificare , e i quale maniera, il seguente script per permettere solo l'upload di file con estensione jpg e gif ed eventualmente settare la dimensione max dell'immagine, per esempio
100 X 100.
Grazie in anticipo per la risposta
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="file" name="imagefile">
<input type="submit" name="Submit" value="Invia">
<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ($_FILES['imagefile']['type'] == "image/gif"){
$filetest = true;
}
else
{
$filetest = false;
}
if ($_FILES['imagefile']['size'] <= "10000"){
$filetest = true;
}
else
{
$filetest = false;
}
if ($filetest == true)
{
copy ($_FILES['imagefile']['tmp_name'], "public/files/".$_FILES['imagefile']['name'])
or die ("Impossibile inviare questo file");
echo "";
echo "
<FONT face=\"Century Gothic\" SIZE=\"1\" >Nome: ".$_FILES['imagefile']['name']."</FONT>
";
echo "<FONT face=\"Century Gothic\" SIZE=\"1\">Size: ".$_FILES['imagefile']['size']."</FONT>
";
echo "<FONT face=\"Century Gothic\" SIZE=\"1\">Tipo: ".$_FILES['imagefile']['type']."</FONT>
";
echo "<FONT face=\"Century Gothic\" SIZE=\"1\" COLOR=\"#33CC00\">Caricata con successo</FONT>";
}
else {
echo "";
echo "<FONT face=\"Century Gothic\" SIZE=\"1\" COLOR=\"#FF0000\">Errore</FONT>(".$_FILES['imagefile']['name'].")(".$_FILES['imagefile']['size'].")";
}
}
?>
</form>