Advanced Multi Uploader Support Product Page

Solved

Multiple Image Upload quit working

Reported 17 Mar 2010 00:39:55
1
has this problem
17 Mar 2010 00:39:55 Heather V posted:
Using the Advanced Image Upload program with the Smart Image Processor to downsize the images, create a Thumbnail, and also post the filename to a database, the product initially worked for a few months. Then it failed. Meaning, the images don't upload (neither the thumbnails), and it will not post to the database table.

After uninstalling, downloading the plug in again, reinstalling all needed extensions, and recreating EVERYTHING, the product doesn't work anymore. All it does is 'blinks', and then stops after awhile.[]

I'm not sure why. Below is all of the code used. I hope someone is able to help:

<?php require_once('../../Connections/rrrr.php'); ?>
<?php require_once('../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../ScriptLibrary/cGraphicMediator.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}
?>
<?php
// Pure PHP Upload 2.1.10
$ppu = new pureFileUpload();
$ppu->path = "../../images/gallery/";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG.gif,jpg,jpeg,bmp,png";
$ppu->formName = "UploadQueue";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "uniq";
$ppu->requireUpload = "true";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "800";
$ppu->progressBar = "";
$ppu->progressWidth = "300";
$ppu->progressHeight = "100";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.10");
$ppu->doUpload();
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#000000");
$sipp2->resize(400, 400, true);
$sipp2->addWatermark("../images/bkgrd/logo.gif", "Center-Center", false, "", "50");
$sipp2->overwrite = true;
$sipp2->saveJPEG(100);
$sipp2->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.6
if (isset($_GET['GP_upload'])) {
$sipp1 = new cGraphicMediator("upload", $ppu, "");
$sipp1->setComponent("Auto");
$sipp1->setMatteColor("#000000");
$sipp1->resize(120, 90, true);
$sipp1->overwrite = false;
$sipp1->setMask("##path##thumbs/##name##.jpg");
$sipp1->saveJPEG(100);
$sipp1->process();
}
?>
<?php
$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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "UploadQueue")) {
  $insertSQL = sprintf("INSERT INTO gallery (filename) VALUES (%s)",
                       GetSQLValueString($_POST['Filedata'], "text"));

  mysql_select_db($database_radmin, $radmin);
  $Result1 = mysql_query($insertSQL, $radmin) or die(mysql_error());

  $insertGoTo = "list.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>



<div style="margin-left: auto; margin-right: auto; width: 500px;"><form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="UploadQueue" id="UploadQueue" onsubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',true,'','','','','','','');return document.MM_returnValue">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0','name','upload1','width','500','height','350','align','middle','id','upload1','src','dmxMultiUploader','quality','best','flashvars','url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&bgStart=#333333&bgEnd=#970000&allowedExtensions=GIF,JPG,JPEG,BMP,PNG.gif,jpg,jpeg,bmp,png','&redirecturl','.$ppu->redirectURL;}?>','wmode','transparent','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','dmxMultiUploader' ); //end AC code
</script><noscript><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" name="upload1" width="500" height="350" align="middle" id="upload1">
<param name="FlashVars" value="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&bgStart=#333333&bgEnd=#970000&allowedExtensions=GIF,JPG,JPEG,BMP,PNG.gif,jpg,jpeg,bmp,png"&redirectUrl=".$ppu->redirectURL;}?>" />
<param name="movie" value="dmxMultiUploader.swf" />
<param name="quality" value="best" />
<param name="wmode" value="transparent" />
<embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&bgStart=#333333&bgEnd=#970000&allowedExtensions=GIF,JPG,JPEG,BMP,PNG.gif,jpg,jpeg,bmp,png"&redirectUrl=".$ppu->redirectURL;}?>" wmode="transparent" type="application/x-shockwave-flash" width="500" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object></noscript>
<input name="Filename" type="file" style="display:none" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',true,'','','','','','','')" />
<input type="hidden" name="Filedata" />
<script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
<input type="hidden" name="MM_insert" value="UploadQueue">
</form></div>

Promoted Solutions

Replied 30 Apr 2010 10:17:55
problem is solved after removing all Server Behaviors and reapplying them in following order:
PAU,
SIP1,2.. etc.
Insert Record

Regards,

Replies

Replied 19 Mar 2010 07:09:44
19 Mar 2010 07:09:44 Heather V replied:
Is there no one to help?
Replied 19 Mar 2010 10:41:28
19 Mar 2010 10:41:28 Teodor Kuduschiev replied:
Hello Heather,
Could you please remove the "/" after "/gallery" from this line:
$ppu->path = "../../images/gallery/";
And try again?
Replied 19 Mar 2010 23:09:45
19 Mar 2010 23:09:45 Heather V replied:
QuoteHello Heather,
Could you please remove the "/" after "/gallery" from this line:
$ppu->path = "../../images/gallery/";
And try again?


OK. I did make that change and it did the same thing.

What I next tried was removing the Smart Image Processor and reapplying them (to update them to the 2.0.7) and it seems to be working at the moment, although I don't understand why that would've made a difference.

Do you think in the near future that you guys will be adding to the Advanced Multi Upload to allow the bulk files to be uploaded within a multiple category form field?

To give you an example, we have hundreds of photos that fall under specific categories. Instead of recreating the AMU for every category, can the AMU be programmed to work within a <form> and upload the filenames to a database based upon a chosen category in a list?
Replied 22 Mar 2010 10:59:41
22 Mar 2010 10:59:41 Miroslav Zografski replied:
Hello Heather,

It is possible to add to the <form>, which the AMU is placed in additional fields and have all this added in to a database.
Replied 22 Mar 2010 18:13:39
22 Mar 2010 18:13:39 Heather V replied:
But it doesn't look like the AMU supports it for each file being uploaded. Each file belongs to a different category, and that doesn't seem to be an option at this point, but thank you for the heads up!
Replied 29 Mar 2010 16:00:30
29 Mar 2010 16:00:30 Miroslav Zografski replied:
Hello Heather,

Well that is so - once set the value is recorder for each file.

Regards,
Replied 28 Apr 2010 23:36:01
28 Apr 2010 23:36:01 Heather V replied:
Looks like it quit again. What's going on?

No error messages. It supposedly succeeds in the upload and processing but there is nothing posted to the database and no files uploaded to the folders. Why?

<?php require_once('../../../ScriptLibrary/incPureUpload.php'); ?>
<?php require_once('../../../ScriptLibrary/cGraphicMediator.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "../../../index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "y";
$MM_donotCheckaccess = "false";

// *** 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 login. 
    // 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 == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "../index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['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
// Pure PHP Upload 2.1.10
$ppu = new pureFileUpload();
$ppu->path = "../../../photogallery";
$ppu->extensions = "GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png";
$ppu->formName = "UploadQueue";
$ppu->storeType = "file";
$ppu->sizeLimit = "";
$ppu->nameConflict = "over";
$ppu->requireUpload = "false";
$ppu->minWidth = "";
$ppu->minHeight = "";
$ppu->maxWidth = "";
$ppu->maxHeight = "";
$ppu->saveWidth = "";
$ppu->saveHeight = "";
$ppu->timeout = "600";
$ppu->progressBar = "";
$ppu->progressWidth = "";
$ppu->progressHeight = "";
$ppu->redirectURL = "";
$ppu->checkVersion("2.1.10");
$ppu->doUpload();
?>
<?php
// Smart Image Processor PHP 2.0.7
if (isset($_GET['GP_upload'])) {
$sipp2 = new cGraphicMediator("upload", $ppu, "");
$sipp2->setComponent("Auto");
$sipp2->setMatteColor("#FFFFFF");
$sipp2->resize(500, 500, true);
$sipp2->overwrite = true;
$sipp2->saveJPEG(80);
$sipp2->process();
}
?>
<?php
// Smart Image Processor PHP 2.0.7
if (isset($_GET['GP_upload'])) {
$sipp1 = new cGraphicMediator("upload", $ppu, "");
$sipp1->setComponent("Auto");
$sipp1->setMatteColor("#FFFFFF");
$sipp1->resize(120, 90, true);
$sipp1->overwrite = false;
$sipp1->setMask("##path##thumbs/##name##.jpg");
$sipp1->saveJPEG(80);
$sipp1->process();
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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;
}
}

$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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "UploadQueue")) {
  $insertSQL = sprintf("INSERT INTO gallery (filename) VALUES (%s)",
                       GetSQLValueString($_POST['Filedata'], "text"));

  mysql_select_db($database_user, $user);
  $Result1 = mysql_query($insertSQL, $user) or die(mysql_error());

  $insertGoTo = "list.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../ccllskkdjf/admin.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="shortcut icon" href="../../../favicon.ico" type="image/x-icon" /> 
<link rel="icon" href="../../../favicon.ico" type="image/x-icon" />
<script src="../../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script language='javascript' src='../../../ScriptLibrary/incPureUpload.js'></script>
</head>

<body>
<div id="body-center">
<div id="sc-body">
<h1> INSERT - photo gallery file </h1>
<ul>
<li>This form is to insert new images for the photo gallery</li>
<li>File size is limited to 3MB </li>
<li>Existing filenames will be overwritten </li>
<li>After upload of images, return to the <a href="list.php">'Photo List</a>' page to select and edit your most recently uploaded files to select a Category and add a Caption for your image.</li>
</ul>
<div style="margin-left: auto; margin-right: auto; width: 400px; border-size: 2px 3px 3px 2px; border-top: #999999; border-right: #666666; border-bottom: #666; border-left: #999; border-style: solid;">
<form action="<?php echo $GP_uploadAction; ?>" method="post" enctype="multipart/form-data" name="UploadQueue" id="UploadQueue" onsubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',false,'','','','','','','');return document.MM_returnValue">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" name="upload1" width="400" height="350" align="middle" id="upload1">
<param name="FlashVars" value="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&bgStart=#CCCCCC&bgEnd=#333333&allowedExtensions=GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png"&redirectUrl=".$ppu->redirectURL;}?>" />
<param name="movie" value="dmxMultiUploader.swf" />
<param name="quality" value="best" />
<param name="wmode" value="transparent" />
<embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&bgStart=#CCCCCC&bgEnd=#CC9966&allowedExtensions=GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png"&redirectUrl=".$ppu->redirectURL;}?>" wmode="transparent" type="application/x-shockwave-flash" width="400" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<input name="Filename" type="file" style="display:none" onchange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG,gif,jpg,jpeg,bmp,png',false,'','','','','','','')" />
<input type="hidden" name="Filedata" />
<script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
</form>

Replied 28 Apr 2010 23:58:55
28 Apr 2010 23:58:55 Heather V replied:
OK. I got the images uploading, but the filename is still not recording in the dbase table.
Replied 29 Apr 2010 10:16:00
29 Apr 2010 10:16:00 Miroslav Zografski replied:
Hello Heather,

Try to remove the redirection in the Insert Record server behavior.

Regards,
Replied 30 Apr 2010 10:17:55
30 Apr 2010 10:17:55 Miroslav Zografski replied:
problem is solved after removing all Server Behaviors and reapplying them in following order:
PAU,
SIP1,2.. etc.
Insert Record

Regards,

Replied 30 Apr 2010 20:32:15
30 Apr 2010 20:32:15 Heather V replied:
Gottcha! Working great now!

Reply to this topic