Advanced Multi Uploader Support Product Page

AMU not posting all filenames to dbase table

Asked 05 May 2010 08:57:17
1
has this question
05 May 2010 08:57:17 Heather V posted:
New problems:

#1: I've upgraded to DWCS4 (yes, I know CS5 is out), installed AMU extension, it is nowhere to be found (in either the INSERT, DMXZONE menu in DESIGN or DESIGN COMPACT mode or Server Behavior, DMXZONE menu)

#2: AMU works great when I upload ten files at a time on a localhost system and does publish to my dbase table just fine. BUT, when I upload the AMU and all the required files on a live server to make it work and attempt to upload more than one file (the same files I tested on a localhost), the files do upload on the server, but only ONE filename records in the dbase. Why?

I've inserted in the following order:
AMU,SIPP,SIPP,INSERT RECORD

The Form:
<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',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" width="500" height="350" id="upload1" align="middle">
<param name="FlashVars" value="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&FlashUpload=true<?php if ($ppu->redirectURL <> '') {echo "&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&FlashUpload=true<?php if ($ppu->redirectURL <> '') {echo "&redirectUrl=".$ppu->redirectURL;}?>" wmode="transparent" type="application/x-shockwave-flash" width="500" 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>
<input type="hidden" name="MM_insert" value="UploadQueue">
</form>



<?php require_once('...php'); ?>
<?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 = "../../images/gallery";
$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 = "300";
$ppu->progressHeight = "100";
$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("#000000");
$sipp2->resize(400, 400, 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("#000000");
$sipp1->resize(300, 100, 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;
}
}

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());
}
?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
?>


How do I fix this one?

Replies

Replied 05 May 2010 10:20:14
05 May 2010 10:20:14 Miroslav Zografski replied:
Hello Heather,

Do you remember that I told you you may have a problem with the Restrict Access server behavior?
Please, set a page without RA on it just for test and upload it on your live server.

Regards,
Replied 05 May 2010 18:35:33
05 May 2010 18:35:33 Heather V replied:
Modified RA using "Securing the Advanced Multi Uploader" suggestion.

Result: filenames record in dbase. First image on list uploads, but second uploads with a broken image link with first SIPP; thumbnails from second SIPP DO NOT UPLOAD. (both files before upload are less than 400K).

Still checking on php.ini.
Replied 05 May 2010 23:22:01
05 May 2010 23:22:01 Heather V replied:
AMU with two SIPP's and INSERT working accordingly by following the order above.

Unfortunately, when I add the Advanced Conditional Region following the instructions here, I get the error:

Parse error: syntax error, unexpected $end in C:\yada\yada\insert.php on line 173

Line 173: is </html> but I'm sure there's an insert '}' somewhere that shouldn't be there.

Form:
<?php if (MM_Username<>"") { // Adv Conditional Region ?>
<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',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" width="500" height="400" id="upload1" align="middle">
<param name="FlashVars" value="url=<?php echo urlencode($GP_uploadAction); ?>&formName=UploadQueue&FlashUpload=true<?php if ($ppu->redirectURL <> '') {echo "&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&FlashUpload=true<?php if ($ppu->redirectURL <> '') {echo "&redirectUrl=".$ppu->redirectURL;}?>" wmode="transparent" type="application/x-shockwave-flash" width="500" height="400" 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>
<input type="hidden" name="MM_insert" value="UploadQueue" />
</form>
<? } // MM_Username<>"" ?>


I had no other way to compare this code. The linked page is for ASP.
Replied 07 May 2010 19:15:21
07 May 2010 19:15:21 Heather V replied:
George was mentioning that there is an error in the code after the SB installs it. Apparently, at the end of the form it says

<? } // MM_Username<>"" ?>


but should be

<?php } // MM_Username<>"" ?>

.

I've made the change and am receiving a different error:
Notice: Use of undefined constant MM_Username - assumed 'MM_Username' in C:\insert.php on line 154

Line 154, of course, is
<?php if (MM_Username<>"") { // Adv Conditional Region ?>



This is becoming quite frustrating and I would appreciate the developers looking into this further to get this product working.

The start of my code is the following:

<?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;
  }
}
?>

Replied 10 May 2010 10:10:47
10 May 2010 10:10:47 Miroslav Zografski replied:
Hello Heather,

You need to remove the RA from that page, keeping only the session start:
 if (!isset($_SESSION)) {  
   session_start();  
}  

Than you need to change the MM_Username with $_SESSION['MM_Username']
so it will be :
<?php if (isset($_SESSION['MM_Username'])&&($_SESSION['MM_Username']<>"")) { // Adv Conditional Region ?>

instead of :
<?php if (MM_Username<>"") { // Adv Conditional Region ?>


Regards,

Reply to this topic