Salve oh saggi
.
Avendo questo script:
Codice PHP:
<FORM ENCTYPE="multipart/form-data" ACTION="readex.php" METHOD="POST">
Upload file: <INPUT TYPE="file" NAME="userfile">
<INPUT TYPE="submit" VALUE="Upload">
</FORM>
<?php
session_start();
// Image file upload by Bloody
// [url]http://www.bloodys.com/[/url]
// email: [email]info@bloodys.com[/email]
// If you use this script, please put a link back to [url]http://www.bloodys.com/[/url]
$foot = "
</div><div style=\"clear: both;\"> </div></div><div id=\"footer\">Elaborazione dei dati: <a href=\"http://www.mapoetto.altervista.org\">Elmapomapo sito 2008 ©</a> Designed by <a href=\"http://www.free-css-templates.com/\">Free CSS Templates</a>, Thanks to <a href=\"http://www.dubaiapartments.biz/villas/\" title=\"Dubai Apartments offers quality furnished hotel apartments, villas, and furnished properties on short term rental basis\" target=\"_blank\">Dubai Villas</a></div>
</div></body> </html>";
$user_path = $_SESSION['username_2']."/";
$path = "../phpExcelReader/FoldUser/$user_path";
$max_size = 2000000;
mkdir("../phpExcelReader/FoldUser/".$_SESSION['username_2']."", 775);
if (!isset($HTTP_POST_FILES['userfile'])) exit;
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "<font color=\"red\">Il file č troppo grande
\n</font> $foot"; exit; }
if ($HTTP_POST_FILES['userfile']['type']=="application/xls" or $HTTP_POST_FILES['userfile']['type']=="text/xls" or $HTTP_POST_FILES['userfile']['type']==".xls" ) {
if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "<font color=\"red\">Il file esiste già ma puoi cambiare il nome(".$path . $HTTP_POST_FILES['userfile']['name'].")
\n</font> $foot"; exit; }
$name_file = $HTTP_POST_FILES['userfile']['name'];
$bla = $path.$name_file;
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $bla);
if (!$res) { echo "<font color=\"red\">L'upload č andato male
\n</font> $foot"; } else { echo "Upload andato a buon fine!
\n</font> $foot"; exit;}
echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."
\n";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes
\n";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."
\n";
} else { echo "<font color=\"red\">Il tipo di file non è consentito!
L'unico consentito è .xls</font> $foot"; exit; }
}
?>
Quando vado a fare l'upload di un file .xls, dice che l'estensione non č accettata.
Io penso che il problema sia risolvibile facilmente con l'inserimento dei parametri corretti nell' IF che verifica l'estensione.
Help me