File field path is lost
In this insert file,when I select a file to to be used as a link on the page, the path is lost. I get the file name loaded but the "../" is lost.
Nick
<?php require_once("../../Connections/conn_ArtCards.php"); ?>
<?php require_once("../../WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once('../../Connections/conn_ArtCards.php'); ?>
<?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;
}
}
mysql_select_db($database_conn_ArtCards, $conn_ArtCards);
$query_rsMenu_pos = "SELECT Id_lbl, value_lbl, label_lbl FROM label WHERE group_lbl = 11";
$rsMenu_pos = mysql_query($query_rsMenu_pos, $conn_ArtCards) or die(mysql_error());
$row_rsMenu_pos = mysql_fetch_assoc($rsMenu_pos);
$totalRows_rsMenu_pos = mysql_num_rows($rsMenu_pos);
mysql_select_db($database_conn_ArtCards, $conn_ArtCards);
$query_rsParent = "SELECT * FROM menuDY WHERE parent_menu_mnu = '0'";
$rsParent = mysql_query($query_rsParent, $conn_ArtCards) or die(mysql_error());
$row_rsParent = mysql_fetch_assoc($rsParent);
$totalRows_rsParent = mysql_num_rows($rsParent);?>
<?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $conn_ArtCards;
$WA_table = "menuDY";
$WA_sessionName = "WADA_Insert_menuDY";
$WA_redirectURL = "menuDY_Results.php";
$WA_keepQueryString = false;
$WA_indexField = "id_mnu";
$WA_fieldNamesStr = "name_mnu|front_mnu|link_mnu|close_class_mnu|text_mnu|back_mnu|parent_order_mnu|parent_menu_mnu|sub_order";
$WA_fieldValuesStr = "".((isset($_POST["name_mnu"]))?$_POST["name_mnu"]:"") ."" . "|" . "".((isset($_POST["front_mnu"]))?$_POST["front_mnu"]:"") ."" . "|" . "".((isset($_POST["link_mnu"]))?$_POST["link_mnu"]:"") ."" . "|" . "".((isset($_POST["close_class_mnu"]))?$_POST["close_class_mnu"]:"") ."" . "|" . "".((isset($_POST["text_mnu"]))?$_POST["text_mnu"]:"") ."" . "|" . "".((isset($_POST["back_mnu"]))?$_POST["back_mnu"]:"") ."" . "|" . "".((isset($_POST["parent_order_mnu"]))?$_POST["parent_order_mnu"]:"") ."" . "|" . "".((isset($_POST["parent_menu_mnu"]))?$_POST["parent_menu_mnu"]:"") ."" . "|" . "".((isset($_POST["sub_order"]))?$_POST["sub_order"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_conn_ArtCards;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
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>Insert menuDY</title>
<link href="../../WA_DataAssist/styles/Refined_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="../../WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="WADAInsertContainer">
<form action="menuDY_Insert.php" method="post" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader">Insert Record</div>
<div class="WADAHorizLine"><img src="../../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">ID</th>
<td class="WADADataTableCell"></td>
</tr>
<tr>
<th class="WADADataTableHeader">Menu</th>
<td class="WADADataTableCell"><select name="name_mnu" id="name_mnu">
<option value="">Select One</option>
<?php
do {
?>
<option value="<?php echo $row_rsMenu_pos['value_lbl']?>"><?php echo $row_rsMenu_pos['label_lbl']?></option>
<?php
} while ($row_rsMenu_pos = mysql_fetch_assoc($rsMenu_pos));
$rows = mysql_num_rows($rsMenu_pos);
if($rows > 0) {
mysql_data_seek($rsMenu_pos, 0);
$row_rsMenu_pos = mysql_fetch_assoc($rsMenu_pos);
}
?>
</select>
<input name="front_mnu" type="hidden" value="<li><a href="" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Item Type</th>
<td class="WADADataTableCell"> </td>
</tr>
<tr>
<th class="WADADataTableHeader">Link<br />
file, document or image</th>
<td class="WADADataTableCell"><input name="link_mnu" type="file" size="50" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">close_class_mnu:</th>
<td class="WADADataTableCell"><input name="close_class_mnu" type="hidden" id="close_class_mnu" value="">" /></td>
</tr>
<tr>
<th class="WADADataTableHeader"> Text/Label</th>
<td class="WADADataTableCell"><input type="text" name="text_mnu" id="text_mnu" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Close</th>
<td class="WADADataTableCell"><input type="radio" name="back_mnu" id="back_mnu" value="</a></li>" />
Single Item no sub-menu<br />
<input type="radio" name="back_mnu" id="back_mnu" value="</a><div><ul>" />
Link to su-menu<br />
<input type="radio" name="back_mnu" id="back_mnu2" value="</a></li></ul></div>" />
last of a sub-menu up to uper level</td>
</tr>
<tr>
<th class="WADADataTableHeader">Parent Order</th>
<td class="WADADataTableCell"><input type="text" name="parent_order_mnu" id="parent_order_mnu" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Parent Menu</th>
<td class="WADADataTableCell"><select name="parent_menu_mnu" id="parent_menu_mnu">
<option value="0">Top Level</option>
<?php
do {
?>
<option value="<?php echo $row_rsParent['id_mnu']?>"><?php echo $row_rsParent['text_mnu']?></option>
<?php
} while ($row_rsParent = mysql_fetch_assoc($rsParent));
$rows = mysql_num_rows($rsParent);
if($rows > 0) {
mysql_data_seek($rsParent, 0);
$row_rsParent = mysql_fetch_assoc($rsParent);
}
?>
</select></td>
</tr>
<tr>
<th class="WADADataTableHeader">Order:</th>
<td class="WADADataTableCell"><input type="text" name="sub_order" id="sub_order" value="" size="2" /></td>
</tr>
</table>
<div class="WADAHorizLine"><img src="../../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="../../WA_DataAssist/images/Pacifica/Refined_insert.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="menuDY_Results.php" title="Cancel"><img border="0" name="Cancel" id="Cancel" alt="Cancel" src="../../WA_DataAssist/images/Pacifica/Refined_cancel.gif" /></a></td>
</tr>
</table>
<input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
</div>
</form>
</div>
</body>
</html>
<?php
mysql_free_result($rsMenu_pos);
mysql_free_result($rsParent);
?>