ciao ho creato un form per l'iserimento di dati in un db con dreamweaver, nel momento che si verifica l'azone ho però anche bisogno che venga avvaito un programma con la funzione system...
.... tutto funziona ma si blocca quando metto della variabili al percorso per eseguire la funzione ...
come devo dunque definirle?
<?php
if(trim($_POST["img1"]) != "")
{$filename_1 = 'DB/foto/'.$_POST["img1"];}
else $filename_1 = 'DB/foto/no.jpg';
?>
QUESTO SERVE SOLO PER PRENDERE DALLA PAGINA PRECEDENTE DELL'UPLOAD IL PERCORSO/NOME DEL FILE
<?php
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;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO tabella_dettagli (immagine1) VALUES (%s)",
GetSQLValueString($_POST['immagine1'], "text"),
mysql_select_db($database_prova, $prova);
$Result1 = mysql_query($insertSQL, $prova) or die(mysql_error());
system ('/home/prova/public_html/$filename_1 -resize 340x255 /home/cavourim/public_html/risultato.jpg');
QUESTO L'HO AGGIUNTO IO PER FARE UN RESIZE NEL MOMENTO CHE VIENE DATA LA CONFERMA ALL'INSERIMENTO DEI VALORI NEL FORM...
$insertGoTo = "inseriscifase3.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
... il problema è che il programma non mi riconosce propio il percorso perchè così scritto non riesce a tradurre la variabile $filename_1 nel vero nome del file, se provo a definirla all'interno del php del'inserimento mi da errore nel form di inserimento appunto, se sostituisco però $filename_1 con pippo.jpg tutto funziona ... ovviamente!!!
![]()
![]()
![]()
![]()
![]()
![]()
![]()