Buona sera a tutti.
Io utilizzo un codice per uploadare file che contemporaneamente inserisce un record in una tabella di un database...
Il mio problema è che oltre un certo peso non riesco ad uploadare... Qualcuno i spiega cosa devo fare?
* = ho provato a modificare il campo in grassetto, ma non serve....
Posto il codice:
Codice PHP:
// codice del form per inviare l'immagine:
<form method="POST" name="form1" enctype="multipart/form-data" id="form1" action="insert_ok.php">
<table class="tabellapicc">
<tr>
<td class="right">Immagine</td>
<td><input name="UploadedFile1" type="file" value="" size="40" />
[B]<input type="hidden" name="MAX_FILE_SIZE" value="1024000000" />*[/B] </td>
</tr>
<tr>
<td class="right">Didascalia</td>
<td><input name="didascalia" type="text" id="didascalia" value="" size="40" /></td>
</tr>
<tr>
<td class="right"></td>
<td><input name="call_utente" type="text" value="" size="40" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Inserisci" class="bottoni"></td>
</tr>
</table>
<input name="id_files" type="hidden" id="id_files" />
</form>
// codiche della pagina "insert_ok", quella che fa l'upload:
<?
$path="percorso_assoluto_directory_per_upload_files";
if( $UploadedFile1 != "" )
{
print("Foto: $UploadedFile1_name
\n");
print("Dimensione del file: $UploadedFile1_size
\n");
if (copy( $UploadedFile1 , "$path/$UploadedFile1_name" )){
print "[b]$UploadedFile1_name[/b] copiato con successo sul server
";
print "<hr>";
}else{
print "[b]Attenzione il campo 1 è vuoto.[/b]
";
print "<hr>";
}
unlink($UploadedFile1);
}else{
print "Errore.. nessun file.
";
}
?>
<?php
$db = mysql_connect("localhost","user","lpassword");
mysql_select_db("nome_database",$db);
function mysql_die($error = "unknown")
{
echo "<H1>Error:". $error."</H1>";
exit;
}
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$sql="INSERT INTO files_files (UploadedFile1, didascalia, call_utente) VALUES ('$UploadedFile1_name' , '$didascalia', '$call_utente')";
mysql_query($sql, $db) or mysql_die("No record");
?>