close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

File field path is lost

Thread began 9/12/2010 12:42 pm by nickj | Last modified 9/13/2010 10:24 am by Jason Byrnes | 536 views | 2 replies |

nickj

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="&lt;li&gt;&lt;a href=&quot;" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Item Type</th>
<td class="WADADataTableCell">&nbsp;</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="&quot;&gt;" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">&nbsp;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="&lt;/a&gt;&lt;/li&gt;" />
Single Item no sub-menu<br />
<input type="radio" name="back_mnu" id="back_mnu" value="&lt;/a&gt;&lt;div&gt;&lt;ul&gt;" />
Link to su-menu<br />
<input type="radio" name="back_mnu" id="back_mnu2" value="&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;" />
last&nbsp; of a sub-menu&nbsp; 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);
?>

Sign in to reply to this post

nickj

The POST is stripping off the path and should only strip off the path to the root!

Sign in to reply to this post

Jason ByrnesWebAssist

I think you are misunderstanding how a file field works.

A file field allows the user to select a file that exists on the client computer, not the server.

you cannot simply add a file field and have the file be uploaded to the server, you will need to add additional code to the page for the upload to occur.

The Universal Email extension includes an Upload file server behavior that can be used to transfer the file from the client computer to the server.

as for storing the file name in the database, yes, it will only store the name not the path.


the path will change from page to page depending where it is on the site. when creating the link, you should include the path to the file upload location.

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