close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Digital File Pro - not uploading file and writing to DB

Thread began 9/24/2009 10:13 am by sandy170299 | Last modified 9/24/2009 12:35 pm by sandy170299 | 1434 views | 2 replies |

sandy170299

Digital File Pro - not uploading file and writing to DB

Digital File Pro is not uploading my file nor is it writing to the database. Here is my code.

<?php require_once('../Connections/studio120.php'); ?>
<?php require_once("../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("../WA_DigitalFilePro/HelperPHP.php"); ?>
<?php require_once("../WA_iRite/WARichEditorPHP.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
$ParamID_WADAmenus = "-1";
if (isset($_GET['ID'])) {
$ParamID_WADAmenus = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
}
mysql_select_db($database_studio120, $studio120);
$query_WADAmenus = sprintf("SELECT ID, menuName, pageContent, pageTitle, photo FROM menus WHERE ID = %s", GetSQLValueString($ParamID_WADAmenus, "int"));
$WADAmenus = mysql_query($query_WADAmenus, $studio120) or die(mysql_error());
$row_WADAmenus = mysql_fetch_assoc($WADAmenus);
$totalRows_WADAmenus = mysql_num_rows($WADAmenus);?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "../",
'FileName' => "[FileName]",
'DefaultFileName' => "".$row_WADAmenus['photo'] ."",
'ResizeType' => "2",
'ResizeWidth' => "150",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "photo", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>
<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $studio120;
$WA_table = "menus";
$WA_redirectURL = "menus_Results.php";
$WA_keepQueryString = false;
$WA_indexField = "ID";
$WA_fieldNamesStr = "menuName|pageContent|pageTitle|photo";
$WA_fieldValuesStr = "".((isset($_POST["menuName"]))?$_POST["menuName"]:"") ."" . "|" . "".((isset($_POST["pageContent"]))?$_POST["pageContent"]:"") ."" . "|" . "".((isset($_POST["pageTitle"]))?$_POST["pageTitle"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = "=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"") ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_studio120;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<!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" />
<title>Update menus</title>
<link href="../WA_DataAssist/styles/Ultramodern_Slate.css" rel="stylesheet" type="text/css" />
<link href="../WA_DataAssist/styles/Verdana.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div class="WADAUpdateContainer">
<?php if ($totalRows_WADAmenus > 0) { // Show if recordset not empty ?>
<form action="menus_Update.php?ID=<?php echo(rawurlencode($row_WADAmenus['ID'])); ?>" method="post" name="WADAUpdateForm" id="WADAUpdateForm">
<div class="WADAHeader">Update Record</div>
<table width="75%" border="0" cellpadding="0" cellspacing="0" class="WADADataTable">
<tr>
<th valign="top" class="WADADataTableHeader">menuName:</th>
<td valign="top" class="WADADataTableCell"><input type="text" name="menuName" id="menuName" value="<?php echo(str_replace('"', '&quot;', $row_WADAmenus['menuName'])); ?>" size="32" /></td>
</tr>
<tr>
<th valign="top" class="WADADataTableHeader">pageContent:</th>
<td valign="top" class="WADADataTableCell"><?php
// WebAssist iRite: Rich Text Editor for Dreamweaver
$WARichTextEditor_1 = CreateRichTextEditor ("pageContent", "../WA_iRite/", "100%", "350px", "Custom", "../custom/menus_Update_pageContent1.js", "".$row_WADAmenus['pageContent'] ."");
?></td>
</tr>
<tr>
<th width="25%" valign="top" class="WADADataTableHeader">pageTitle:</th>
<td valign="top" class="WADADataTableCell"><input type="text" name="pageTitle" id="pageTitle" value="<?php echo(str_replace('"', '&quot;', $row_WADAmenus['pageTitle'])); ?>" size="32" /></td>
</tr>
<tr>
<th valign="top" class="WADADataTableHeader">photo:</th>
<td valign="top" class="WADADataTableCell"><input name="photo" type="file" id="photo" size="55" /></td>
</tr>
</table>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Update" id="Update" value="Update" alt="Update" src="../WA_DataAssist/images/Slate/Ultramodern_update.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="menus_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="../WA_DataAssist/images/Slate/Ultramodern_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAUpdateRecordID" type="hidden" id="WADAUpdateRecordID" value="<?php echo(rawurlencode($row_WADAmenus['ID'])); ?>" />
</div>
</form>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_WADAmenus == 0) { // Show if recordset empty ?>
<div class="WADANoResults">
<div class="WADANoResultsMessage">No record found.</div>
</div>
<?php } // Show if recordset empty ?>
</div>
</body>
</html>
<?php
mysql_free_result($WADAmenus);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

For file uploads to occur, the forms encoding type needds to be set to multipart/form-data.



change the form tag:
<form action="menus_Update.php?ID=<?php echo(rawurlencode($row_WADAmenus['ID'])); ?>" method="post" name="WADAUpdateForm" id="WADAUpdateForm">

to:
<form action="menus_Update.php?ID=<?php echo(rawurlencode($row_WADAmenus['ID'])); ?>" method="post" enctype="multipart/form-data" name="WADAUpdateForm" id="WADAUpdateForm">

Sign in to reply to this post

sandy170299

Hah! Thank you, Jason :) You rock once again! I created everything with DataAssist and neglected to check that part of the form.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...