close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Download file as PDF from DA setup

Thread began 3/05/2010 12:09 am by downloads336743 | Last modified 3/08/2010 12:54 am by downloads336743 | 1338 views | 6 replies |

downloads336743

Download file as PDF from DA setup

Hi there,

I'm using DFP in conjunction with DataAssist. I have got the setup sorted so that i can upload files and they store fine on the database. Most of the files will either be PDF or MP3. But i can't work out how to enable user to click onto the name of the file and have (the PDF) open in a separate page.

Can anyone help? I've tried different link options but not getting anywhere.

Appreciate any help,
Cheers
Nic

Sign in to reply to this post

Jimmy Wu

Are you storing the files on the server or directly in the database? If you are uploading the files to the server, then you should be able to have a relative link to the pdf to have it open.

Sign in to reply to this post

downloads336743

Hi,
It's to a database. But this is not totally necessary. I really only used DataAssist so that it would show what the file description is - ie the file is sheetmusic so i wanted to put a description of what it's about. If there is another way to do this without using DataAssist, then i'd be happy to hear! Although the uploading and making it as a link has to be done via the server and not hand coded onto the webpage as this is for a client who won't be accessing the web pages.
Thanks for your help,
Nic :-)

Sign in to reply to this post

anonymous

Nic,

The easiest way to do this is through link targeting. Since it looks like your populating the links dynamically, you could simply create your link like this:

<a href="locationOfFileFolder/<?php echo $row_pdf['myfile']; ?>" target="_blank">Download PDF</a>

The trick is to set target to "_blank". Keep in mind, though, that some browsers will just force it to download if the browser does not have pdf reading capabilities.

Brian

Sign in to reply to this post

downloads336743

Hi Brian,
I tried it, but it just opens the server folder on the web page and shows what's in the folder...I'm assuming it's the 'detail' page (in DataAssist) that i include the code you mentioned. So anyway, this is the code as it now stands with yours included (i changed your $row_pdf to $row_WADAmusicuploads - which is what all the others had though i did try it with $row_pdf as well)('Upload' is the database table field) :

<div class="WADADetailsContainer"> <a name="top"></a>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<?php if ($totalRows_WADAmusicuploads > 0) { // Show if recordset not empty ?>
<div id="WADADetails">
<div class="WADAHeader">Details</div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">Music Name:</th>
<td class="WADADataTableCell"><?php echo($row_WADAmusicuploads['ItemName']); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Music Description:</th>
<td class="WADADataTableCell"><?php echo($row_WADAmusicuploads['ItemDescription']); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Music Type:</th>
<td class="WADADataTableCell"><?php echo($row_WADAmusicuploads['ItemType']); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Upload Music:</th>
<td class="WADADataTableCell"><a href="uploaded_files/<?php echo $row_WADAmusicuploads['Upload']; ?>" target="_blank">Download PDF</a></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"><a href="admin/musicuploads_Update.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="Update"><img border="0" name="Update" id="Update" alt="Update" src="../WA_DataAssist/images/Slate/Traditional_update.gif" /></a></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="admin/musicuploads_Delete.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="Delete"><img border="0" name="Delete" id="Delete" alt="Delete" src="../WA_DataAssist/images/Slate/Traditional_delete.gif" /></a></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="musicuploads_Results.php" title="Results"><img border="0" name="Results" id="Results" alt="Results" src="../WA_DataAssist/images/Slate/Traditional_results.gif" /></a></td>
</tr>
</table>
</div>
</div>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_WADAmusicuploads == 0) { // Show if recordset empty ?>
<div class="WADANoResults">
<div class="WADANoResultsMessage">No record found.</div>
</div>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<div class="WADADetailsLinkArea">
<div class="WADADataNavButtonCell"><a href="musicuploads_Results.php" title="Results"><img border="0" name="Results1" id="Results1" alt="Results" src="../WA_DataAssist/images/Slate/Traditional_results.gif" /></a></div>
</div>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<?php } // Show if recordset empty ?>
</div>

Sign in to reply to this post

anonymous

Can you provide a link to the page online? I want to see what is being outputted versus the code that you are using.

If the folder is opening in the browser instead of the file, it tells me that the value for the file is probably not making it to the binding in the link.

You may also want to attach the actual page here so we can see all the code including the recordset query. It seems like there may be a slight code error that is causing you the problem.

Regards

Sign in to reply to this post

downloads336743

Hi Brian,
I can't really give a public URL as it's a members section but i am emailing you with a login.
I've managed to fix it so that they can download, however for this to work they need to upload the song with exactly the same wording in the ItemName title as the wording of the PDF which while still working is not ideal as i would like for them to be able to call it whatever they like but have it still pulled from the database depending on what record they choose...Anyway, here is the page as it stands now (sorry it's pretty long!) :



<?php require_once('../../Connections/belacappella.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;
}
}
?>
<?php
if (!session_id()) session_start();
?>
<?php
$ParamItemID_WADAmusicuploads = "-1";
if (isset($_GET['ItemID'])) {
$ParamItemID_WADAmusicuploads = (get_magic_quotes_gpc()) ? $_GET['ItemID'] : addslashes($_GET['ItemID']);
}
$ParamSessionItemID_WADAmusicuploads = "-1";
if (isset($_SESSION['WADA_Insert_musicuploads'])) {
$ParamSessionItemID_WADAmusicuploads = (get_magic_quotes_gpc()) ? $_SESSION['WADA_Insert_musicuploads'] : addslashes($_SESSION['WADA_Insert_musicuploads']);
}
$ParamItemID2_WADAmusicuploads = "-1";
if (isset($_GET['ItemID'])) {
$ParamItemID2_WADAmusicuploads = (get_magic_quotes_gpc()) ? $_GET['ItemID'] : addslashes($_GET['ItemID']);
}
mysql_select_db($database_belacappella, $belacappella);
$query_WADAmusicuploads = sprintf("SELECT ItemID, ItemName, ItemDescription, ItemType FROM musicuploads WHERE ItemID = %s OR ( -1= %s AND ItemID= %s)", GetSQLValueString($ParamItemID_WADAmusicuploads, "int"),GetSQLValueString($ParamItemID2_WADAmusicuploads, "int"),GetSQLValueString($ParamSessionItemID_WADAmusicuploads, "int"));
$WADAmusicuploads = mysql_query($query_WADAmusicuploads, $belacappella) or die(mysql_error());
$row_WADAmusicuploads = mysql_fetch_assoc($WADAmusicuploads);
$totalRows_WADAmusicuploads = mysql_num_rows($WADAmusicuploads);
?>
<!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>Bel A Cappella</title>
<link href="../../styles/main.css" rel="stylesheet" type="text/css" />
<link href="../../styles/navigation.css" rel="stylesheet" type="text/css" />

<link href="../../styles/members.css" rel="stylesheet" type="text/css" />
<link href="../../WA_DataAssist/styles/Traditional_Slate.css" rel="stylesheet" type="text/css" />
<link href="../../WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
<style type="text/css">
/* Details page CSS */
.WADADetailsContainer {
font-size: 11px;
}
#WADADetails {
padding-top: 5px;
}
</style>

<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="../../styles/iestyles.css" media="all" />
<![endif]-->

<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="../../styles/ie7minus.css" media="all" />
<![endif]-->

<!--[if lte IE 7]>
<style type="text/css">
#menu ul {display:inline;}
#menu li a.fly:hover {background-color:#ddd; }
#menu {text-align:left; padding-top: 8px;}
</style>
<![endif]-->


</head>

<body>
<div id="wrapper">
<div id="insideWrapperTop"></div>
<div id="insideWrapperMiddle">

<div id="insideWrapperContent">



<div class="insideNavEtc">
<div id="topMainLinks">
<div id="menu">
<ul class="level1">
<li class="level1-li"><a class="level1-a" href="../../index.html">site home</a></li>
<li class="level1-li left"><a class="level1-a" href="../index.php">members home</a></li>
<li class="level1-li left"><a class="level1-a" href="index2.php">admin home</a></li>









</ul>
</div>
</div>

<div id="bannerTestimonialInside">
<h1>“What a great performance. The music was outstanding <br />
and the vocals uplifting. What a marvellous night!”</h1>
</div>
</div>




<div class="twoColLeft">
<div class="leftMemberNav">
<ul>
<li><a href="memberlogin_Insert.php">insert member user details</a></li>
<li><a href="memberlogin_Results.php">search / modify member details</a></li>
<li><a href="adminlogin_Registration.php">register admin user</a></li>
<li><a href="adminlogin_Profile.php">update admin user details</a></li>
<li><a href="musicuploads_Insert.php">upload sheetmusic</a></li>
<li><a href="musicuploads_Results.php">delete sheetmusic</a></li>
<li><a href="how_to_upload_photographs.php">upload photographs to the gallery</a></li>
<li><a href="send_newsletter.php">send a newsletter</a></li>
<li><a href="#">contact president</a></li>
</ul>
</div>
</div>

<div class="twoColRight">
<div class="insideText">
<br /> <h1>ADMIN - Show Details Of Musical Record / Sheetmusic
<a name="top"></a>
</h1>
<div class="WADADetailsContainer">
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<?php if ($totalRows_WADAmusicuploads > 0) { // Show if recordset not empty ?>
<div id="WADADetails">
<div class="WADAHeader"></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">Music Name:</th>
<td class="WADADataTableCell"><?php echo($row_WADAmusicuploads['ItemName']); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Music Description:</th>
<td class="WADADataTableCell"><?php echo($row_WADAmusicuploads['ItemDescription']); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Music Type:</th>
<td class="WADADataTableCell"><?php echo($row_WADAmusicuploads['ItemType']); ?></td>
</tr>
<tr>
<th class="WADADataTableHeader">Upload Music:</th>
<td class="WADADataTableCell"><a href="../uploaded_files/<?php echo $row_WADAmusicuploads['ItemName']; ?>.pdf" target="_blank">Download PDF</a></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"><a href="musicuploads_Update.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="Update"><img border="0" name="Update" id="Update" alt="Update" src="../../WA_DataAssist/images/Slate/Traditional_update.gif" /></a></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="musicuploads_Delete.php?ItemID=<?php echo(rawurlencode($row_WADAmusicuploads['ItemID'])); ?>" title="Delete"><img border="0" name="Delete" id="Delete" alt="Delete" src="../../WA_DataAssist/images/Slate/Traditional_delete.gif" /></a></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><a href="musicuploads_Results.php" title="Results"><img border="0" name="Results" id="Results" alt="Results" src="../../WA_DataAssist/images/Slate/Traditional_results.gif" /></a></td>
</tr>
</table>
</div>
</div>
<?php } // Show if recordset not empty ?>
<?php if ($totalRows_WADAmusicuploads == 0) { // Show if recordset empty ?>
<div class="WADANoResults">
<div class="WADANoResultsMessage">No record found.</div>
</div>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<div class="WADADetailsLinkArea">
<div class="WADADataNavButtonCell"><a href="musicuploads_Results.php" title="Results"><img border="0" name="Results1" id="Results1" alt="Results" src="../../WA_DataAssist/images/Slate/Traditional_results.gif" /></a></div>
</div>
<div class="WADAHorizLine"><img src="../WA_DataAssist/images/_tx_.gif" alt="" height="1" width="1" border="0" /></div>
<?php } // Show if recordset empty ?>
</div><br />
</p>
</div>
<p>&nbsp;</p>
</div>

<div class="bottomSpacer"></div>
</div>

</div>
<div id="insideWrapperBottom">
<div class="insideWrapperBottomBorder"></div>
<p><a href="http://www.overloadweb.com.au" target="_blank">&copy; 2010 Bel A Cappella :: design by Overload</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</div>
</body>
</html>
<?php
mysql_free_result($WADAmusicuploads);
?>

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