close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

When I update my file name is deleted

Thread began 4/20/2010 1:50 pm by jegoadby285710 | Last modified 5/25/2012 9:49 am by jegoadby285710 | 5312 views | 47 replies

veevee06427071

I'm having the same issue.

When I update the form without re-selecting an image, the filename in the database is erased. Below I've inserted the image name from the query as the default file name but still no luck.

Please Help!

<?php include('inc.header.php');?>
<?php require_once('Connections/BDF.php'); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "images/ads/",
'FileName' => "[FileName]",
'DefaultFileName' => "".$row_deals['deal_image']."",
'ResizeType' => "1",
'ResizeWidth' => "400",
'ResizeHeight' => "400",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1_2 Start
$WA_UploadResult1_Params["WA_UploadResult1_2"] = array(
'UploadFolder' => "images/ads/",
'FileName' => "thumb_[FileName]",
'DefaultFileName' => "thumb_".$row_deals['deal_image']."",
'ResizeType' => "1",
'ResizeWidth' => "250",
'ResizeHeight' => "250",
'ResizeFillColor' => "" );
// WA_UploadResult1_2 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "adimage", "2", "[NewFileName]_[Increment]", "true", $WA_UploadResult1_Params);
}
?>
<?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;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

echo $WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"];

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "ads1")) {

$updateSQL = sprintf("UPDATE deals SET deal_region=%s, deal_image=%s, deal_active=%s WHERE deal_id=%s",
GetSQLValueString($_POST['region'], "text"),
GetSQLValueString($WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"], "text"),
GetSQLValueString($_POST['active'], "int"),
GetSQLValueString($_POST['dealid'], "int"));

mysql_select_db($database_BDF, $BDF);
$Result1 = mysql_query($updateSQL, $BDF) or die(mysql_error());

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

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...