<HTML>
<HEAD>
<TITLE>Upload system - Shutdown</TITLE>
</HEAD>
<BODY>
<FORM ENCTYPE="multipart/form-data" ACTION="<?= $_SERVER["PHP_SELF"] ?>" METHOD="POST">
Immagine: <INPUT TYPE="file" NAME="userfile">
<INPUT TYPE="submit" VALUE="Upload">
</FORM>
<?php
# Percorso di destinazione
$path = "./";
# Grandezza massima espressa in byte
$size = 1000000;
# Hanno spedito un file!?
# Quanto e' grande!?
if($HTTP_POST_FILES['userfile']['size']<$size) {
# E' un'immagine!?
if(($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) {
# Il file e' già esistente?
if(!file_exists($path . $HTTP_POST_FILES['userfile']['name'])) {
# Copio il file nella destinazione
$result = @copy($HTTP_POST_FILES['userfile']['tmp_name'], $path.$HTTP_POST_FILES['userfile']['name']);
# L'ho copiato!?
if($result) {
echo("Nome file: ".$HTTP_POST_FILES['userfile']['name']."<br>");
echo("Grandezza: ".$HTTP_POST_FILES['userfile']['size']." byte<br>");
echo("Tipo file: ".$HTTP_POST_FILES['userfile']['type']."<br>");
}
else
echo("Imp. copiare il file nella destinazione!");
}
else
# Si' esiste
echo("Il file esiste già!");
}
else
echo("Formato file non accettato!");
}
else
echo("File troppo grande!");
}
?>
</BODY>
</HTML>