Salve
Ho problema con caricare immagini.. il puto del percorso assoluto...
ho chiesto al consulting web loro mi hanno dato il percorso e anche mi hanno dato permesso di scrittura sulla cartella specificata. che sarebbe questo:
D:\romawebservice.com\diessearredamenti.com\images \cucine
ho provato anche senza punti tra nome di domini e com
Pero' non mi funziona. Qualcuno mi sa dire dove sbaglio?
Incollo tutto codice sotto:
Grazie tante.
<?php require_once('../Connections/connCucina.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they log in.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "fail.php";
if (!((isset($HTTP_SESSION_VARS['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $HTTP_SESSION_VARS['MM_Username'], $HTTP_SESSION_VARS['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $HTTP_SERVER_VARS['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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 != "") ? "'" . date("Y-d-m",strtotime($theValue)) . "'" : "NULL";
break;
case "time":
$theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "datetime":
$theValue = ($theValue != "") ? "'" . date("Y-d-m H:i:s",strtotime($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_update"])) && ($_POST["MM_update"] == "form1")) {
$fotopiccola = $HTTP_POST_VARS['nomefotopiccola'];
$fotogrande = $HTTP_POST_VARS['nomefotogrande'];
//user defined variables
$abpath = "D:\romawebservice.com\diessearredamenti.com\image s\cucine"; //Absolute path to where images are uploaded. No trailing slash
$sizelim = "no"; //Do you want size limit, yes or no
$size = "2500000"; //What do you want size limited to be if there is one
//all image types to upload
$cert1 = "image/pjpeg"; //Jpeg type 1
$cert2 = "image/jpeg"; //Jpeg type 2
$cert3 = "image/gif"; //Gif type
$cert4 = "image/ief"; //Ief type
$cert5 = "image/png"; //Png type
$cert6 = "image/tiff"; //Tiff type
$cert7 = "image/bmp"; //Bmp Type
$cert8 = "image/vnd.wap.wbmp"; //Wbmp type
$cert9 = "image/x-cmu-raster"; //Ras type
$cert10 = "image/x-x-portable-anymap"; //Pnm type
$cert11 = "image/x-portable-bitmap"; //Pbm type
$cert12 = "image/x-portable-graymap"; //Pgm type
$cert13 = "image/x-portable-pixmap"; //Ppm type
$cert14 = "image/x-rgb"; //Rgb type
$cert15 = "image/x-xbitmap"; //Xbm type
$cert16 = "image/x-xpixmap"; //Xpm type
$cert17 = "image/x-xwindowdump"; //Xwd type
$log = "";
//begin upload 1
$nomeimg = $img1_name;
$nomeimg1 = $img2_name;
//checks if file exists
if ($img1_name == "") {
$log .= "Nessun file selezionato per il caricamento dell'immagine piccola
";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img1_size > $size) {
$log .= "L'immagine piccola è troppo grande
";
}
}
//Checks if file is an image
if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3) or ($img1_type == $cert4) or ($img1_type == $cert5) or ($img1_type == $cert6) or ($img1_type == $cert7) or ($img1_type == $cert8) or ($img1_type == $cert9) or ($img1_type == $cert10) or ($img1_type == $cert11) or ($img1_type == $cert12) or ($img1_type == $cert13) or ($img1_type == $cert14) or ($img1_type == $cert15) or ($img1_type == $cert16) or ($img1_type == $cert17)) {
@copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server
";
if (file_exists("$abpath/$img1_name")) {
$log .= "L'immagine piccola è stata caricata con successo
";
$fotopiccola = "D:\romawebservice.com\diessearredamenti.com\image s\cucine".$img1_name;
}
} else {
$log .= "L'immagine piccola non è un file immagine(jpg o gif)
";
}
}
//checks if file exists
if ($img2_name == "") {
$log .= "Nessun file selezionato per il caricamento dell'immagine grande
";
} else {
//checks if files to big
if ($sizelim == "yes") {
if ($img2_size > $size) {
$log .= "L'immagine grande è troppo grande
";
}
}
//Checks if file is an image
if (($img2_type == $cert1) or ($img2_type == $cert2) or ($img2_type == $cert3) or ($img2_type == $cert4) or ($img2_type == $cert5) or ($img2_type == $cert6) or ($img2_type == $cert7) or ($img2_type == $cert8) or ($img2_type == $cert9) or ($img2_type == $cert10) or ($img2_type == $cert11) or ($img2_type == $cert12) or ($img2_type == $cert13) or ($img2_type == $cert14) or ($img2_type == $cert15) or ($img2_type == $cert16) or ($img2_type == $cert17)) {
@copy($img2, "$abpath/$img2_name") or $log .= "Couldn't copy image 2 to server
";
if (file_exists("$abpath/$img2_name")) {
$log .= "L'immagine grande è stata caricata con successo
";
$fotogrande = "D:\romawebservice.com\diessearredamenti.com\image s\cucine".$img2_name;
}
} else {
$log .= "L'immagine piccola non è un file immagine(jpg o gif)
";
}
}
$updateSQL = sprintf("INSERT INTO tbfoto(nome, testofoto, nomefotopiccola, nomefotogrande, categoria, visualizza) VALUES ( %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($fotopiccola, "text"),
GetSQLValueString($fotogrande, "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['visualizza'], "text"),
GetSQLValueString($_POST['descrizione'], "text"));
mysql_select_db($database_connCucina, $connCucina);
$Result1 = mysql_query($updateSQL, $connCucina) or die(mysql_error());
$updateGoTo = "foto.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_rsCucine = "1";
if (isset($_GET['ID'])) {
$colname_rsCucine = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_connCucina, $connCucina);
$query_rsCucine = sprintf("SELECT * FROM tbfoto WHERE ID = %s", $colname_rsCucine);
$rsCucine = mysql_query($query_rsCucine, $connCucina) or die(mysql_error());
$row_rsCucine = mysql_fetch_assoc($rsCucine);
$totalRows_rsCucine = mysql_num_rows($rsCucine);
?>