|
Posted by nicemotion on 11/23/07 16:37
Hi all,
the following easy script correctly insert a record in the DB but is
not moving the images (Logo and Foto) to the server /foto folder.
can't understand why 'cause the script is easy and correct and i guess
it loses the $file_temp var (actually the printout of $file_temp0
return nothing)
i even tryed to write it repeating the parameters i/o using variables
but no results.
Anyone can help ?
Many thanks in advance
Nik
-----------------------------------
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1"))
{
//// set variables
$file_temp0=($_FILES['Logo']['tmp_name']);
$file_temp1=($_FILES['Foto']['tmp_name']);
//folder of the image on the server
$percorso="foto/";
$nuovo_nome0=$percorso.$_POST['Logo'];
$nuovo_nome1=$percorso.$_POST['Foto'];
$insertSQL = sprintf("INSERT INTO marcalinea (ID_MarcaLinea, Marca_,
LineaProdotto_, Logo, Foto, Descrizione, Pdf_) VALUES (%s, %s, %s, %s,
%s, %s, %s)",
GetSQLValueString($_POST['ID_MarcaLinea'],
"int"),
GetSQLValueString($_POST['Marca_'], "int"),
GetSQLValueString($_POST['LineaProdotto_'],
"int"),
GetSQLValueString($nuovo_nome0, "text"),
GetSQLValueString($nuovo_nome1, "text"),
GetSQLValueString($_POST['Descrizione'],
"text"),
GetSQLValueString($_POST['Pdf_'], "int"));
//print ($file_temp0); // return nothings
//print ($nuovo_nome0); // returns correctly /foto/img_name
mysql_select_db($database_Conn_Bianchi, $Conn_Bianchi);
$Result1 = mysql_query($insertSQL, $Conn_Bianchi) or
die(mysql_error());
////Everything ok 'till here; the following does't works:
######### upload image########
move_uploaded_file($file_temp0, $nuovo_nome0);
move_uploaded_file($_FILES["Foto"]["tmp_name"],"foto/" .
$_FILES["Foto"]["name"]);
###############################
$insertGoTo = "view.php";
etc...
Navigation:
[Reply to this message]
|