ciao a tutti,
non riesco a cancellare un file pdf dal server
codice:<?php require_once('../../Connections/aconn.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; } if ((isset($_GET['Id'])) && ($_GET['Id'] != "")) { $deleteSQL = sprintf("DELETE FROM settore WHERE Id=%s", GetSQLValueString($_GET['Id'], "int")); mysql_select_db($database_aconn, $aconn); $Result1 = mysql_query($deleteSQL, $aconn) or die(mysql_error()); $ro = mysql_fetch_array($Result1); $dir = "../../pdf/"+$ro["file"]+".pdf"; if(unlink($dir)){ echo "Eliminato."; } $deleteGoTo = "../success.php?success=RECORD ELIMINATO CON SUCCESSO!"; if (isset($_SERVER['QUERY_STRING'])) { $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?"; $deleteGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $deleteGoTo)); } ?>
:master:
Grazie

Rispondi quotando