Pure PHP Upload Add-On Pack Support Product Page
Delete before update not working.. No errors
Asked 28 Sep 2009 23:43:10
1
has this question
28 Sep 2009 23:43:10 rob vlaan posted:
Hello...I am having trouble with deleting file before update behavior php. There are no errors. Just not deleting the old files. New files get uploaded and rewritten correctly and updates to dbasefields for image and width and height occur correctly aswell... The old files just do not get deleted...
I tried several workarounds and options I found on the forums, but none worked... It is like it is completely skipping the whole block...
// Delete Before Update Addon 1.0.7
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "Form1") {
mysql_select_db($database_admin, $admin);
$dbu_result = mysql_query("SELECT * FROM Titels WHERE T_Id=".$_POST['T_Id'], $admin) or die(mysql_error());
$dbu = new deleteFileBeforeUpdate($ppu);
$dbu->pathThumb = "../Titels";
$dbu->naming = "prefix";
$dbu->suffix = "thumb200_";
$dbu->checkVersion("1.0.7"
while ($dbu->sqldata = mysql_fetch_array($dbu_result)) {
$dbu->deleteFile();
}
}
Any help would be appreciated...
Replies
Replied 29 Sep 2009 08:09:01
29 Sep 2009 08:09:01 Patrick Julicher replied:
Hi Rob,
Please post the code for the complete page. Maybe there is something wrong in the order the code is on your page?
Kind regards, Patrick
Please post the code for the complete page. Maybe there is something wrong in the order the code is on your page?
Kind regards, Patrick
Replied 29 Sep 2009 18:28:22
29 Sep 2009 18:28:22 rob vlaan replied:
Hi Patrick tnx for your reply...
<?php
// Pure PHP Upload 2.1.9
$ppu = new pureFileUpload();
$ppu->path = "../Titels";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
$ppu->formName = "Form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "false";
$ppu->minWidth = "160";
$ppu->minHeight = "250";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "Breed";
$ppu->saveHeight = "Hoog";
$ppu->timeout = "10000";
$ppu->progressBar = "blueFlashProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.9"
$ppu->doUpload();
?>
<?php
// Rename Uploaded Files Addon 1.0.7
if (isset($_GET['GP_upload'])) {
$ruf = new renameUploadedFiles($ppu);
$filename = ((isset($_POST["ISBN"]))?$_POST["ISBN"]:""
$ruf->renameMask = "$filename.##ext##";
$ruf->checkVersion("1.0.7"
$ruf->doRename();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp300 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp300->setComponent("Auto"
$sipp300->setMatteColor("#FFFFFF"
$sipp300->resize(300, 469, true);
$sipp300->overwrite = true;
$sipp300->saveJPEG(100);
$sipp300->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp160 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp160->setComponent("Auto"
$sipp160->setMatteColor("#FFFFFF"
$sipp160->resize(160, 250, true);
$sipp160->overwrite = false;
$sipp160->setMask("##path##thumb160_##name##.jpg"
$sipp160->saveJPEG(100);
$sipp160->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp200 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp200->setComponent("Auto"
$sipp200->setMatteColor("#FFFFFF"
$sipp200->resize(200, 313, true);
$sipp200->overwrite = false;
$sipp200->setMask("##path##thumb200_##name##.jpg"
$sipp200->saveJPEG(100);
$sipp200->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp100 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp100->setComponent("Auto"
$sipp100->setMatteColor("#FFFFFF"
$sipp100->resize(100, 156, true);
$sipp100->overwrite = false;
$sipp100->setMask("##path##thumb100_##name##.jpg"
$sipp100->saveJPEG(100);
$sipp100->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp80 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp80->setComponent("Auto"
$sipp80->setMatteColor("#FFFFFF"
$sipp80->resize(80, 125, true);
$sipp80->overwrite = false;
$sipp80->setMask("##path##thumb80_##name##.jpg"
$sipp80->saveJPEG(100);
$sipp80->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp60 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp60->setComponent("Auto"
$sipp60->setMatteColor("#FFFFFF"
$sipp60->resize(60, 94, true);
$sipp60->overwrite = false;
$sipp60->setMask("##path##thumb60_##name##.jpg"
$sipp60->saveJPEG(100);
$sipp60->process();
}
?>
<?php
//MX Widgets3 include
require_once('../includes/wdg/WDG.php');
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
// Delete Before Update Addon 1.0.7
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "Form1") {
mysql_select_db($database_admin, $admin);
$dbu_result = mysql_query("SELECT * FROM Titels WHERE T_Id=".$_POST['T_Id'], $admin) or die(mysql_error());
$dbu = new deleteFileBeforeUpdate($ppu);
$dbu->pathThumb = "../Titels";
$dbu->naming = "prefix";
$dbu->suffix = "thumb200_";
$dbu->checkVersion("1.0.7"
while ($dbu->sqldata = mysql_fetch_array($dbu_result)) {
$dbu->deleteFile();
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
if(isset($mm_abort_edit) && $mm_abort_edit)
{
}
else
{
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "Form1") {
$updateSQL = sprintf("UPDATE Titels SET T_Titel=%s, T_ISBN=%s, T_Omslag=IFNULL(%s,T_Omslag), T_Breed=IFNULL(%s,T_Breed), T_Hoog=IFNULL(%s,T_Hoog) WHERE T_Id=%s",
GetSQLValueString($_POST['Titel'], "text",
GetSQLValueString($_POST['ISBN'], "text",
GetSQLValueString($_POST['omslag'], "text",
GetSQLValueString($_POST['Breed'], "text",
GetSQLValueString($_POST['Hoog'], "text",
GetSQLValueString($_POST['T_Id'], "int");
mysql_select_db($database_admin, $admin);
$Result1 = mysql_query($updateSQL, $admin) or die(mysql_error());
$updateGoTo = "09_titel_updated.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
}
?>
<?php
// Pure PHP Upload 2.1.9
$ppu = new pureFileUpload();
$ppu->path = "../Titels";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG";
$ppu->formName = "Form1";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "false";
$ppu->minWidth = "160";
$ppu->minHeight = "250";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "Breed";
$ppu->saveHeight = "Hoog";
$ppu->timeout = "10000";
$ppu->progressBar = "blueFlashProgress.htm";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.9"
$ppu->doUpload();
?>
<?php
// Rename Uploaded Files Addon 1.0.7
if (isset($_GET['GP_upload'])) {
$ruf = new renameUploadedFiles($ppu);
$filename = ((isset($_POST["ISBN"]))?$_POST["ISBN"]:""
$ruf->renameMask = "$filename.##ext##";
$ruf->checkVersion("1.0.7"
$ruf->doRename();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp300 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp300->setComponent("Auto"
$sipp300->setMatteColor("#FFFFFF"
$sipp300->resize(300, 469, true);
$sipp300->overwrite = true;
$sipp300->saveJPEG(100);
$sipp300->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp160 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp160->setComponent("Auto"
$sipp160->setMatteColor("#FFFFFF"
$sipp160->resize(160, 250, true);
$sipp160->overwrite = false;
$sipp160->setMask("##path##thumb160_##name##.jpg"
$sipp160->saveJPEG(100);
$sipp160->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp200 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp200->setComponent("Auto"
$sipp200->setMatteColor("#FFFFFF"
$sipp200->resize(200, 313, true);
$sipp200->overwrite = false;
$sipp200->setMask("##path##thumb200_##name##.jpg"
$sipp200->saveJPEG(100);
$sipp200->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp100 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp100->setComponent("Auto"
$sipp100->setMatteColor("#FFFFFF"
$sipp100->resize(100, 156, true);
$sipp100->overwrite = false;
$sipp100->setMask("##path##thumb100_##name##.jpg"
$sipp100->saveJPEG(100);
$sipp100->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp80 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp80->setComponent("Auto"
$sipp80->setMatteColor("#FFFFFF"
$sipp80->resize(80, 125, true);
$sipp80->overwrite = false;
$sipp80->setMask("##path##thumb80_##name##.jpg"
$sipp80->saveJPEG(100);
$sipp80->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp60 = new cGraphicMediator("upload", $ppu, "omslag"
$sipp60->setComponent("Auto"
$sipp60->setMatteColor("#FFFFFF"
$sipp60->resize(60, 94, true);
$sipp60->overwrite = false;
$sipp60->setMask("##path##thumb60_##name##.jpg"
$sipp60->saveJPEG(100);
$sipp60->process();
}
?>
<?php
//MX Widgets3 include
require_once('../includes/wdg/WDG.php');
if (!function_exists("GetSQLValueString") {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = ""
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string" ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
// Delete Before Update Addon 1.0.7
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "Form1") {
mysql_select_db($database_admin, $admin);
$dbu_result = mysql_query("SELECT * FROM Titels WHERE T_Id=".$_POST['T_Id'], $admin) or die(mysql_error());
$dbu = new deleteFileBeforeUpdate($ppu);
$dbu->pathThumb = "../Titels";
$dbu->naming = "prefix";
$dbu->suffix = "thumb200_";
$dbu->checkVersion("1.0.7"
while ($dbu->sqldata = mysql_fetch_array($dbu_result)) {
$dbu->deleteFile();
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($editFormAction)) {
if (isset($_SERVER['QUERY_STRING'])) {
if (!eregi("GP_upload=true", $_SERVER['QUERY_STRING'])) {
$editFormAction .= "&GP_upload=true";
}
} else {
$editFormAction .= "?GP_upload=true";
}
}
if(isset($mm_abort_edit) && $mm_abort_edit)
{
}
else
{
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "Form1") {
$updateSQL = sprintf("UPDATE Titels SET T_Titel=%s, T_ISBN=%s, T_Omslag=IFNULL(%s,T_Omslag), T_Breed=IFNULL(%s,T_Breed), T_Hoog=IFNULL(%s,T_Hoog) WHERE T_Id=%s",
GetSQLValueString($_POST['Titel'], "text",
GetSQLValueString($_POST['ISBN'], "text",
GetSQLValueString($_POST['omslag'], "text",
GetSQLValueString($_POST['Breed'], "text",
GetSQLValueString($_POST['Hoog'], "text",
GetSQLValueString($_POST['T_Id'], "int");
mysql_select_db($database_admin, $admin);
$Result1 = mysql_query($updateSQL, $admin) or die(mysql_error());
$updateGoTo = "09_titel_updated.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
}
?>
Replied 29 Sep 2009 22:59:57
29 Sep 2009 22:59:57 Patrick Julicher replied:
Hi Rob,
I'll do some testing with the Delete option and then get back to you.
Kind regards, Patrick
I'll do some testing with the Delete option and then get back to you.
Kind regards, Patrick
Replied 23 Jun 2010 14:25:18
23 Jun 2010 14:25:18 rob vlaan replied:
I never heard back on this post.. This problem is still playing... response would be nice...