salve ho scaricato questo upload dal sito di aruba però non è come immaginavo
questo e il sistema di upload
protezione.php
codice:
<?php
# settare nella riga seguente la password
if ($passwd=="linkbruttocane"): ?>
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Demo: esempio di Form Upload interamente in Php</title>
</html>
<html>
<head>
</head>
<body bgcolor="#ffffff">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td width="100%"><table width="400" height="47" border="0" align="center" cellpadding="00">
<tr>
<td width="475" background="sf_tit.jpg"><div align="center"><span class="nero_sott">
Area Protetta </span></div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="100%" height="290"><div align="center">
<table width="400" height="250" border="0" cellpadding="00">
<tr>
<td background="sf_table.jpg"><form action="up.php" method="post"
enctype="multipart/form-data">
<label for="file"></label>
<div align="center">
<label for="label"><span class="nero">Filename:</span></label>
<span class="nero">
<input name="file" type="file" class="azzurro" id="file" />
</span>
<input name="submit" type="submit" class="azzurro" value="Submit" />
</div>
</form></td>
</tr>
</table>
</div>
</tr>
</table>
</center>
</div>
<? else: ?>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>area protetta</title>
<div align="center" class="azzurro">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td width="100%"><table width="400" height="47" border="0" align="center" cellpadding="00">
<tr>
<td background="sf_tit.jpg"><div align="center"><span class="nero_sott">
Area protetta - Non sei autorizzato all'accesso</span></div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="100%" height="290"><table width="24%" height="19" border="0" align="center" cellpadding="00">
<tr>
<td width="486"><div align="center" class="codice"><a href="accesso_area_upload.htm" class="codice">
Password non corretta,
torna al LOGIN</a></div></td>
</tr>
</table></td>
</tr>
</table>
</center>
</div>
<? endif; ?>
</body>
</html>
up.php
codice:
<?php
//linkbruttocane 08 luglio 2008
//dichiaro in automatico il percorso dei files uploadati
//calcolo document_root sottraendo il numero di caratteri del path_translated
if(!isset($_SERVER['DOCUMENT_ROOT'])){
if(isset($_SERVER['SCRIPT_FILENAME'])){
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])));
};
};
if(!isset($_SERVER['DOCUMENT_ROOT'])){
if(isset($_SERVER['PATH_TRANSLATED'])){
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
};
};
$PercorsoDominio = $_SERVER['DOCUMENT_ROOT'];
//echo "
".$PercorsoDominio;
$public = "/public/upload/";
if(is_dir($PercorsoDominio.$public))
{
echo "<font color=green>Check cartella OK.</font>
";
}
else
{
echo "<font color=red>ATTENZIONE LA CARTELLA DI DESTINAZIONE NON ESISTE. FARE RIFERIMENTO ALLA GUIDA, CREARE LA CARTELLA. UPLOAD NON RIUSCITO</font>
";
exit;
}
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg")
|| ($_FILES["file"]["type"] == "application/zip")
|| ($_FILES["file"]["type"] == "application/x-zip-compressed")
|| ($_FILES["file"]["type"] == "application/x-shockwave-flash"))
&& ($_FILES["file"]["size"] < 2000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "
";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "
";
echo "Tipo: " . $_FILES["file"]["type"] . "
";
echo "Dimensione: " . ($_FILES["file"]["size"] / 1024) . " Kb
";
echo "File temporaneo: " . $_FILES["file"]["tmp_name"] . "
";
if (file_exists($PercorsoDominio. $public . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " esistente. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
$PercorsoDominio. $public . $_FILES["file"]["name"]);
echo "Upload eseguito con successo";
}
}
}
else
{
echo "Tipo di file non valido";
}
?>
dato che di programmazione non ne capisco nnt ma mi arrampico sugli specchi
volevo chedervi se è possibile inserire un contatore di tempo, esempio:ùal termine del upload mancano 1 minuto e 30 secondi
Grazie a tutti ciaoooo!!!!