close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Download trying to download itself

Thread begun 7/22/2010 10:13 am by sandy259886 | Last modified 7/23/2010 6:53 am by Jason Byrnes | 1584 views | 5 replies |

sandy259886

Download trying to download itself

Universal Email download form action has to be set for the form button to make the file download. I set the action to the same page (pagename) and when I click the download button, the current page downloads ... not the download file specified in the download server behavior.

How do I set the form action so that it will work and not try to download itself?

Sign in to reply to this post

Jason ByrnesWebAssist

please send a copy of the page so I can examine the code.

Sign in to reply to this post

sandy259886

copy of page

<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?><?php require_once('../../Connections/xxx.php'); ?>
<?php require_once("../../webassist/file_manipulation/helperphp.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;
}
}

$colname_rsebook = "-1";
if (isset($_GET['ebook'])) {
$colname_rsebook = (get_magic_quotes_gpc()) ? $_GET['ebook'] : addslashes($_GET['ebook']);
}
mysql_select_db($database_traders, $traders);
$query_rsebook = sprintf("SELECT * FROM prod WHERE EbookLink = %s ", GetSQLValueString($colname_rsebook, "text"));
$rsebook = mysql_query($query_rsebook, $traders) or die(mysql_error());
$row_rsebook = mysql_fetch_assoc($rsebook);
$totalRows_rsebook = mysql_num_rows($rsebook);

$paramItemNo_rsDesc = "-1";
if (isset($row_rsebook['itemNumber'])) {
$paramItemNo_rsDesc = (get_magic_quotes_gpc()) ? $row_rsebook['itemNumber'] : addslashes($row_rsebook['itemNumber']);
}
mysql_select_db($database_traders, $traders);
$query_rsDesc = sprintf("SELECT * FROM proddesc WHERE itemNum = %s", GetSQLValueString($paramItemNo_rsDesc, "text"));
$rsDesc = mysql_query($query_rsDesc, $traders) or die(mysql_error());
$row_rsDesc = mysql_fetch_assoc($rsDesc);
$totalRows_rsDesc = mysql_num_rows($rsDesc);

$paramItemNum_rsAuthor = "-1";
if (isset($row_rsebook['itemNumber'])) {
$paramItemNum_rsAuthor = (get_magic_quotes_gpc()) ? $row_rsebook['itemNumber'] : addslashes($row_rsebook['itemNumber']);
}
mysql_select_db($database_traders, $traders);
$query_rsAuthor = sprintf("SELECT * FROM assignauth, authors WHERE prodID = %s AND assignauth.authorID = authors.AuthID", GetSQLValueString($paramItemNum_rsAuthor, "text"));
$rsAuthor = mysql_query($query_rsAuthor, $traders) or die(mysql_error());
$row_rsAuthor = mysql_fetch_assoc($rsAuthor);
$totalRows_rsAuthor = mysql_num_rows($rsAuthor);?>
<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["download"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "../../../_downloadFiles", "".$row_rsebook['EbookLink'] ."", "".$row_rsebook['EbookLink'] ."", false, false, false, "", "", "", "");
}
?>
<!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>Untitled Document</title>
<link href="../../siteassist_css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<p>&nbsp;</p>
<table width="750" align="center" cellpadding="5">
<tr>
<td colspan="3">
<p>Item Number: <?php echo $row_rsebook['itemNumber']; ?></p>
<h3><?php echo $row_rsebook['Title']; ?><?php echo $row_rsebook['subTitle']; ?></h3>
</td>
</tr>
<tr>
<td width="150" align="center" valign="top">
<p><img src="../../bookimages/<?php echo $row_rsebook['SmallImage']; ?>" alt="<?php echo $row_rsebook['Title']; ?>" /></p>
<p>Author(s):<br />
<?php do { ?>

<?php echo $row_rsAuthor['AuthFName']; ?>&nbsp;<?php echo $row_rsAuthor['AuthLName']; ?><br />


<?php } while ($row_rsAuthor = mysql_fetch_assoc($rsAuthor)); ?></p>
</td>
<td colspan="2" valign="top">
<p><?php echo $row_rsDesc['shortDesc']; ?></p>
<div style="margin:25px">
<form id="downloadForm" name="downloadForm" method="post" action="download.php">
<input type="submit" name="download" id="download" value="Download eBook" />
</form></div>
<p>&nbsp;</p>
</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($rsebook);

mysql_free_result($rsDesc);

mysql_free_result($rsAuthor);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

change the forms action to:
<form id="downloadForm" name="downloadForm" method="post" action="download.php?ebook=<?php echo(isset($_GET['ebook']):$_GET['ebook']:""); ?>">

so that the ebook querystring variable being used by the rsebook recordset has a value when the form submits.

Sign in to reply to this post

sandy259886

working now using session variable

Well ... your solution didn't work, but it let me know that if I could get that variable set correctly, it might solve the problem. On pageload, I set a session variable for the record number. I used that session variable in the form action to set the page correctly. The download is working now. Thanks so much. Sometimes it takes 2 minds to figure it out.

Sign in to reply to this post

Jason ByrnesWebAssist

OK, glad to hear it is working now.

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