Siccome mi stampa "Si sono verificati dei problemi durante l'Upload" che è l'else dell'if sulla funzione move_uploaded_file avevo pensato al nome temporaneo del file...
Codice PHP:
<?PHP
include 'config.php';
include 'opendb.php';
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"table.css\">";
mysql_select_db($dbname, $conn);
$cartella = 'mdb-database/';
$descrizione = $_POST['descrizione'];
$percorso = $_FILES['miofile']['tmp_name'];
$nome = $_FILES['miofile']['name'];
$tipo = $_FILES['miofile']['type'];
$size = $_FILES['miofile']['size'];
if (move_uploaded_file($percorso, $cartella . $nome))
{
//inserimento in documenti
$query = "INSERT INTO documenti (id_doc, nome_doc, descrizione, data_insert) values (\"\", \"$nome\", \"$descrizione\", now())";
mysql_query($query) or die(mysql_error());
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die(mysql_error());
//PRENDO L'ID DEL DOCUMENTO APPENA INSERITO
$sql = "SELECT `id_doc` FROM `documenti` WHERE `nome_doc` = \"";
$sql .= $nome;
$sql .= "\"";
$result = mysql_query($sql, $conn);
$row = mysql_fetch_array($result);
$iddoc = $row['id_doc'];
//inserimento in documenti_utenti
$lungh_array = count($_POST['check']);
for ($i = 0; $i < $lungh_array; $i++) {
$query = "INSERT INTO utenti_documenti (id_utente, id_documenti) values (\"";
$query .= $_POST['check'][$i];
$query .= "\", \"$iddoc\")";
mysql_query($query) or die(mysql_error());
}
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die(mysql_error());
$kb = $size/1000;
echo "
<div align=\"center\">
<table>
<caption>Upload documento eseguito con successo</caption>
<tbody><tr>
<th scope=\"row\" align=\"right\" ><font color=\"#669999\">Nome file:</font></th>
<th> $nome </th></tr>
<tr>
<th scope=\"row\" align=\"right\" ><font color=\"#669999\">Tipo:</font></th>
<th> $tipo </th></tr>
<tr>
<th scope=\"row\" align=\"right\" ><font color=\"#669999\">Dimensione:</font></th>
<th> $kb kb </th></tr>
</table>
";
echo "
<a href=\"javascript:history.back()\"><font face=\"verdana\" color=\"#669999\" size=\"1\">[ indietro ]</font></a> </div>";
}
else
{
print "Si sono verificati dei problemi durante l'Upload";
}
?>